Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to set json type jquery ajax

$.ajax({
    type: "POST",
    contentType: "application/json",
    url: 'http://localhost:16329/Hello',
    data: { name: 'norm' },
    dataType: "json"
});
Comment

jquery ajax type json

$.ajax('/jquery/submitData', {
    type: 'POST',  // http method
    data: { myData: 'This is my data.' },  // data to submit
  	dataType: 'json',
    success: function (data, status, xhr) {
        $('p').append('status: ' + status + ', data: ' + data);
    },
    error: function (jqXhr, textStatus, errorMessage) {
            $('p').append('Error' + errorMessage);
    }
});
Comment

how to set json type jquery ajax

        $.ajax({
            type: "POST",
            url: siteRoot + "api/SpaceGame/AddPlayer",
            async: false,
            data: JSON.stringify({ Name: playersShip.name, Credits: playersShip.credits }),
            contentType: "application/json",
            complete: function (data) {
            console.log(data);
            wait = false;
        }
    });
Comment

PREVIOUS NEXT
Code Example
Javascript :: react empty space 
Javascript :: how to check if selector exists or is present puppeteer 
Javascript :: import react icons module 
Javascript :: How to use font awewsome in react app 
Javascript :: sleep in react 
Javascript :: javascript repeat each second 
Javascript :: how to select html body in javascript 
Javascript :: godot destroy node 
Javascript :: jquery select outer html 
Javascript :: javascript find file extension from string 
Javascript :: jquery remove element by id 
Javascript :: jquery wait for element to exist 
Javascript :: best way to detect mobile device jquery 
Javascript :: js remove trailing slash 
Javascript :: react native seperator code 
Javascript :: How to tell if an attribute exists on an object 
Javascript :: react bootstrap colors not working 
Javascript :: how to download image in canvas javascript as named 
Javascript :: first child element javascript 
Javascript :: javascript remove last characters from string 
Javascript :: javascript hass class 
Javascript :: javascript detect ios device 
Javascript :: get values form query params in next js 
Javascript :: generate jwt secret key 
Javascript :: js timer loop 
Javascript :: download canvas as image 
Javascript :: string to url javascript 
Javascript :: jest expect async function to throw error 
Javascript :: js localstorage boolean 
Javascript :: mongodb nodejs connect localhost 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =