vendredi 27 février 2015

Send data with ajax, return json


I want to send a string and return json.


This works but it doesn't return json code



$.ajax({
url: "getFeed.php",
type: "post",
data: myString
});


When I want it to return a json string, it gives me an error.



$.ajax({
url: 'getFeed.php',
type: "post",
data: {string1: "testdata", string2: "testdata"},
dataType: 'jsonp',
jsonp: 'jsoncallback',
timeout: 5000,
});


For some reason the server doesn't recieve any data.


How am I supposed to write this? (i want to send 2 strings)





Aucun commentaire:

Enregistrer un commentaire