php - Javascript array conversion to jQuery.post's data -


I am trying to send different values ​​to php scripts using jQuery.post

I Want data that is such a link

  http://example.com/image1.jpg http://example.com/image2.jpg http://example.com/image3 .jpg http: //example.com/image4.jpg  

I do not have a precise number of these links based on the conversation with the user with my script

< P> I am storing these links in a JavaScript array "File links".

I have to send php to these links using jQuery.post

Can I format these sizes in these sizes?

  jQuery.post (MyAjax.ajaxurl, {action: 'ajax-rform', link1: http://example.com/image1.jpg, link2: http: // Example Com / Image2.jpg, link3: http://example.com/image3.jpg, link4: http://example.com/image4.jpg,}, function (data) {jQuery ("# ​​fileupload"). Fter ('& lt; h1 & gt; Success & lt; / h1 & gt; & lt; p & gt; Your registration has been received. & Lt; / p & gt;';)}); In Php I just need to use for loop and change link 1 and with array and php it will iterate for me but what should I do in javascript?  

thanks

just pass to the array JQuery sign code with this array notation , And PHP will set it back in an array:

  jQuery.post (MyAjax.ajaxurl, {action: 'ajax-rform', link: fileLinks}, function (data) {JQuery ("# ​​fileupload"). ('& Lt; h1 & gt; success & lt; / h1 & gt; & lt; p & gt; Your registration has been received. & Lt; / p & gt; ; ';)});  

In PHP, you can access the array as $ _ POST ['link'] .


Comments