I am using jQuery to create a JSON array, and now from the client side how do I pass or post the JSON array to the server/backend from the modal window?
When i click “Save Changes” on the modal window i want to pass/ post the
var data = $(this).serializeObject() to the server.
How can I go about doing it from the client side using jQuery or javascript?
My code is here in jsfiddle http://jsfiddle.net/dev1212/GP2Y6/30/ ( modal window is not showing up in the fiddle when the user click submit but work on my local machine)
Is the right way to go about posting it to the server?
Would this be the right way to pass the JSON array data to the server?
This is my updated version:
$.ajax({
type: 'POST',
url: 'http://re-directb-acktohomepage.com/',
contentType:'application/json'
data: data,
success:
alert('success');
});
Use
"$.ajax"and put your json data through the"data"parameter. You will get the data in the request object sending to the server.Cheers