Home Serializing to JSON in jQuery
Reply: 0

Serializing to JSON in jQuery

user856
1#
user856 Published in June 25, 2018, 4:04 am

This question already has an answer here:

  • Serializing an object to JSON 3 answers

I need to serialize an object to JSON. I'm using jQuery. Is there a "standard" way to do this?

My specific situation: I have an array defined as shown below:

var countries = new Array();
countries[0] = 'ga';
countries[1] = 'cd';
...

and I need to turn this into a string to pass to $.ajax() like this:

$.ajax({
    type: "POST",
    url: "Concessions.aspx/GetConcessions",
    data: "{'countries':['ga','cd']}",
...
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.590109 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO