I have this piece of code in my PHP code:
while ($row = mysqli_fetch_assoc($result))
{
extract($row);
echo \"\";
echo \"
-
If you have to post that array only and not other input fields, this is a clean and quick solution:
var selectedbooks = $('book_form input[name^="bookArray["]').serialize();
alert (selectedbooks);
Explaination:
The selector ^= selects all elements with a name attribute value starting with 'bookArray', the open square bracket '[' makes sure the element is the array we want to serialize and not just a variable starting with the string 'bookArray'.
讨论(0)
-
You have to replace left square brackets and right square brackets with this:
data: $(this).serialize().replace(/%5B/g, '[').replace(/%5D/g, ']'),
讨论(0)
- 热议问题