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 :: search string in file node 
Javascript :: save in json file js 
Javascript :: javascript read xlsx file 
Javascript :: remove prefix js 
Javascript :: print webpage in javascript 
Javascript :: jquery find type submit 
Javascript :: character to ascii in js 
Javascript :: slick on init 
Javascript :: bash parse json 
Javascript :: angular formarray remove all 
Javascript :: Javascript - check if div contains a word? - Stack Overflow 
Javascript :: email validation regex 
Javascript :: check when keyup an input from a specific form jquery 
Javascript :: js console log input value 
Javascript :: javascript iterate through object 
Javascript :: find array javascript 
Javascript :: set a timer for 10 minutes 
Javascript :: angular 10 get unique values from array of objects 
Javascript :: javascript fetch post form data 
Javascript :: how to get day from javascript date 
Javascript :: thinkful 
Javascript :: random hexadecimal character js 
Javascript :: veu scroll to top 
Javascript :: set playback speed js 
Javascript :: javascript json string 
Javascript :: Selector All Element querySelector Method 
Javascript :: protractor right click on element 
Javascript :: detect touch react 
Javascript :: how to make react router Link active 
Javascript :: javascript wait for function to return value 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =