javascript - Getting data from ajax -


im trying send data ajax:

var id_cookie = read_cookie('replay_id'); id_cookie = json.stringify(id_cookie); $.ajax({         url: remote_ip+':8124/show_replay',         data: {cookie: id_cookie},         datatype: "jsonp",         jsonpcallback: "start_replay",         cache: false,         timeout: 5000,         success: function(data) {             console.log("received data: "+data);             console.log(data);         },         error: function(jqxhr, textstatus, errorthrown) {             alert('error ' + textstatus + " " + errorthrown);         } }); 

and when receive want access data

else if (req.method === "get") { 

// sent data here. req.data undefined. how can reach it?

in php, value of "cookie" parameter, can use:

$_get["cookie"] 

if you're not sure if or post, can use:

$_request["cookie"] 

i'd change name of data you're sending "cookie" less ambiguous, avoid confusion actual cookies.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -