How to use 'data:' in jQuery AJAX function?

accepted
As you're making a HTTP GET request, data needs to be key-value pairs, as that's how a GET request is constructed (e.g. /get.php?var1=a&var2=b&var3=c).
jQuery.ajax() accepts this key-value pairs as either an object map, or a string, as described in the documentation:
Data to be sent to the server. It is converted to a query string, if not already a string. It's appended to the url for GET-requests. See processData option to prevent this automatic processing. Object must be Key/Value pairs. If value is an Array, jQuery serializes multiple values with same key based on the value of the traditional setting (described below).
So you should use either;
data: "value=22"
or
data: {
    value: 22
}
Then in PHP you can use $_GET['value'] to retrieve it.
Previous
Next Post »

Featured post

how to remove notification device hd capable lenovo vibe k5

what is lenovo hd capable device. your device is hd capable notification remove how to remove notification device hd capable le...