jquery ajax problem -


A few days ago I posted this question:
who created a series of divs using this code with me ( "+ I). SlideDown () seems ("input") addClass ("SomeClass") .; }

My problem is that I now need to get the values ​​of each #play div and send it to a php script via AJAX. If I had a certain number of divs, then I could do it easily, but how do I have to do it when I do not know how many #play will be?

More details!

It seems that I did not explain clearly in my basic question, so I will try and explain things better.
I want to use an AJAX phone in the remote php script. $ .pos t jQuery method I can send the information of remote scripts very easily. Here's an example:

  $ ("# submit"). Click (function () ($ {. .post ("..// include / process.php", {play_0: $ ("(" # play \ _2 "). Val (), play_3: $ (" # play (" (Play);} ();} ();};);};};};} The php script can now access this information via the $ _POST array - just like a normal form submission. 
If I can generate divs (#play_) using a loop, then the way I I did the above, the 'rigid code' in that the $ .post method really contained me in the syntax There is a need to include a loop somewhere - I can not work to do this work! I hope that it has made things clear.

is jQuery selector, then you can easily loop through them Create your object ...

  // An empty object Data = {}; // all & lt; div & gt; those elements have an ID attribute that starts with "play_" var divs = $ ("div [id ^ = play_]"); // l & Gt; Div & gt; Elements, each function of jQuery using divs.each (function () (// current jQuery with div we are looping div = $ (this); // current div var id = div.attr (" Id "); // The value of the current div var val = div.html (); // object properties can be set dynamically in javascript data [id] = val;}; // is looped, All properties have been warned (data.play_0);  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -