Passing JSON data to .getJSON in jQuery? Passing JSON data to .getJSON in jQuery? json json

Passing JSON data to .getJSON in jQuery?


according to the site, this is valid:

$.getJSON("test.js", { name: "John", time: "2pm" }, function(json) {    alert("JSON Data: " + json.users[3].name);    });

so try:

var data = {    SomeID: "18",    Utc: null,    Flags: "324"};$.getJSON("https://somewhere.com/AllGet?callback=?", data, function (result) {    alert(result);});

edit: http://api.jquery.com/jQuery.getJSON/


Dont use JSON.stringfy, just pass data as it is.

$.getJSON("https://somewhere.com/AllGet?callback=?", data, function (result) {    alert(result);});


When you provide data to a jQuery GET request, it expects an object, not a JSON string, for constructing the query string parameters. Try changing your original code to just this:

$.getJSON("https://somewhere.com/AllGet?callback=?", data, function (result) {    alert(result);});