Skip to main content

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.

Comments

Popular posts from this blog

jQuery Plugin To Create Editable Hotspots On Any Elements

jQuery Plugin To Create Editable Hotspots On Any Elements Hotspot is a jQuery plugin used to generate hotspots (e.g. comments, image annotations, text notes) on any Html elements. Features: Display mode: Display hotspots like a tooltip. Can be triggered with hover or click. Admin mode: Add/remove/edit your custom hotspots and save them in local storage. Allows to handle hotspots via Ajax calls. Callback events supported. Basic Usage: 1. Include jQuery library together with jQuery hotspot's stylesheet & script in the document. 1 < link   rel = "stylesheet"   href = "jquery.hotspot.css" > 2 < script   src = "//code.jquery.com/jquery-1.11.1.min.js" ></ script > 3 < script   src = "jquery.hotspot.js" ></ script > 2. Wrap the image into a DIV element. 1 < div   id = "image-hotspots" > 2    < img   src = "images/1.jpg" > 3 </ ...

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 lenovo vibe k5

New Apple Health App For Organ Donation

New Apple Health App For Organ Donation New Apple Health App For Organ Donation Apple and Donate Life America on Tuesday reported an organization to offer an organ gift application when the new iOS 10 overhaul gets to be accessible this fall. iPhone clients will have the capacity to enlist for the system with two or three taps of a catch. They’ll have the capacity to sign up to make organ, eye or tissue donations, naturally entering their data in the National Donate Life Registry, which is managed by Donate Life America. The project can speed  organ donations  to around 120,000 individuals right now currently waiting for some type of organ or tissue transplant, as per the organizations. There as of now are more than 29,000 individuals a year getting transplants, yet one individual dies each hour however waiting for an organ to end up accessible. The trust is that this electronic registry will interface more potential donors with patients who urgently need to di...