javascript - How to send very big amount of data to server using ajax -


i practicing ajax , want send big amount of data server (for instance want make tags post can 20 tags). concatenate each tag specific symbol between them , in server filter , convert many tags again don't think that's natural way. best way send say, 30 - 40 entries server ajax optimally.

update (as of people suggested showing js code example):

$(document).ready(function(){     var tagstosend = "tag1%tag2%tag3%tag4%tag5%tag6%tag7%tag8%tag9%tag10%tag11%tag12%tag13";      $.ajax({         url: "test.php",          method: "post",         data: {             tags: tagstosend         },         success: function(result){             alert(result)         }     }); }) 

so in server i'll iterate on given tags string , filter each tag. , want more natural way.

i think better way sending tags as json array , not get parameter. this:

var postdata = {}; postdata['tagstosend'] = ["tag1", "tag2", ...]; 

and inside ajax config:

data: json.stringify(data) 

now, can json in php file , parse php array. can have more readable , cleaner request server.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -