what is the best way to post array in ajax?
Started on: 23 January 13
Participants: 1
I have an java script array created as
var ar = new Array();ar[0] = 'foo';
ar[1] = 'bar';
I need to know what is best way to post it to server using ajax (jquery) .
Thanks in advance
var ar = new Array();ar[0] = 'foo';
ar[1] = 'bar';
I need to know what is best way to post it to server using ajax (jquery) .
Thanks in advance
This challenge is listed under
Development & Implementations
Community
Related Posts:
Please login to reply this post
Important:
- We hope the conversations that take place on MyTechLogy.com will be constructive and thought-provoking.
- To ensure the quality of the discussion, our moderators may review/edit the comments for clarity and relevance.
- Comments that are promotional, mean-spirited, or off-topic may be deleted per the moderators' judgment.
1 Suggestion
Hi please try to use the below way
use type: "POST" in ajax call
var ar = new Array(); ar[0] = 'foo'; ar[1] = 'bar'; $.ajax({ url: url_to_post, type: "POST", dataType: 'json', data: {'ar': ar}, complete: function(data){ } else { } } });