Here is how POST
data should be formatted:
key1=value1&key2=value2&key3=value3
In your case (note the &
as a separator):
'code=" + code + "&userid=' + userid
But jQuery does that for you if you specify your data as an object:
data: { code: code, userid: userid }
More Related Contents:
- I want to use jquery nested sortable plugin with drag and drop in codeigniter using mysqli
- How do I post multiple parameters to a URL
- Can anyone help me what is wrong in this code ajax using with php? [closed]
- How do I close a connection early?
- Laravel csrf token mismatch for ajax POST Request
- Simple jQuery, PHP and JSONP example?
- Using Jquery Ajax to retrieve data from Mysql
- Update data on a page without refreshing
- Passing JavaScript array to PHP through jQuery $.ajax
- jQuery – Call ajax every 10 seconds
- Creating jQuery AJAX requests to a PHP function
- Send multiple checkbox data to PHP via jQuery ajax()
- Change DIV content using ajax, php and jQuery
- Update fee dynamically based on radio buttons in Woocommerce checkout
- Submitting JSON data via JQuery ajax.post to PHP
- Redirect with PHP after ajax call
- Difference between php echo and return in terms of a jQuery ajax call [closed]
- jquery using ajax to send data and save in php [duplicate]
- jQuery $.ajax request of dataType json will not retrieve data from PHP script
- Get variable from PHP file using JQuery/AJAX
- Using AJAX to pass variable to PHP and retrieve those using AJAX again
- How to pass an array using PHP & Ajax to Javascript?
- Jquery: Running AJAX locally without a webserver
- How to populate dependable drop-down using Ajax and php [closed]
- How can I pass variables from JavaScript to PHP?
- Call PHP function from jQuery?
- How to show ajax loading gif animation while the page is loading?
- boolean variables posted through AJAX being treated as strings in server side
- json_encode not working with a html string as value
- How to implement a chat room using Jquery/PHP?