Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax post request string data instead of object
    text
    copied!<p>Similar to <a href="https://stackoverflow.com/questions/5046930/jquery-send-string-as-post-parameters">this question</a> I need to send a string as data in a post request. </p> <p>Unlike that one, I can't use an object because I have repeated items. As you can see in my sample data sn1, sn2 and sn3 are repeated several times on different datetimes. </p> <p>Sample data:</p> <p><code>&amp;sn3=2013-2-4T12:43:52&amp;sn3=2013-2-4T12:43:55&amp;sn1=2013-2-4T12:43:59&amp;sn1=2013-2-4T12:44:0&amp;sn2=2013-2-4T12:44:0&amp;sn3=2013-2-4T12:44:2&amp;sn2=2013-2-4T12:44:3&amp;sn3=2013-2-4T12:44:19&amp;sn3=2013-2-4T12:44:19&amp;sn3=2013-2-4T12:44:19&amp;sn2=2013-2-4T12:44:19&amp;sn3=2013-2-4T12:44:21&amp;sn2=2013-2-4T12:44:22&amp;sn2=2013-2-4T12:46:39&amp;sn3=2013-2-4T12:46:42&amp;sn2=2013-2-4T12:46:44&amp;sn2=2013-2-4T12:46:45&amp;sn2=2013-2-4T12:46:46&amp;sn2=2013-2-4T12:47:27&amp;sn2=2013-2-4T12:47:27&amp;sn2=2013-2-4T12:49:44&amp;sn2=2013-2-4T12:50:21&amp;sn2=2013-2-4T12:52:21&amp;sn2=2013-2-4T12:52:24&amp;sn2=2013-2-4T12:57:35&amp;sn3=2013-2-4T12:57:38&amp;sn3=2013-2-4T12:57:39&amp;sn2=2013-2-4T12:57:39&amp;sn2=2013-2-4T12:57:40&amp;sn3=2013-2-4T12:57:46&amp;sn3=2013-2-4T13:21:30</code></p> <p>I tried using the following </p> <pre><code>console.log(screens); //logs my sample data posted above. $.ajax({ url : url, type: "POST", dataType : 'text', data : screens, success : function(data) { console.log("sucessfull sending:") console.log(data); }, error : function() { console.log('failed'); } }); </code></pre> <p>But it always triggers failed. </p> <p>Can I send it as a string? If not, how can I send multiple items with the same key?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload