HI I'm tring to fingure out how to send input element array to jQuery ajax $.post.
my input element array looks like =
"<input type="text" name="name[]" id="name[]">"
I'm also using a jQuery plugin to another box to the name input
something like this -
coldfusionjedi.com/index.cfm/2009/2/19/Using-jQuery-to-add-form-fields "Raymond Camden's ColdFusion Blog: Using jQuery to add form fields"
Here is the code I'm trying to uses.
senddata.php:Code:$(document).ready(function() { $("#myform").submit(function() { $("#msgbox3").removeClass().addClass('messagebox').text('Adding....').fadeIn(1000); $.post("senddata.php",{ nane:$('#nane').val(), } ,function(data) { if(data=='yes') //if correct login detail { alert(data); $("#msgbox3").fadeTo(200,0.1,function() //start fading the messagebox { $(this).html('New name has been added...').addClass('messageboxok').fadeTo(900,1, function() { $.unblockUI(); }); }); } else { alert(data); $("#msgbox3").fadeTo(200,0.1,function() //start fading the messagebox { $(this).html('That name has already been added...').addClass('messageboxerror').fadeTo(900,1); }); } }); return false; }); $("#add_btm").blur(function() { $("#add_form").trigger('submit'); }); }); </script>
When it alerts, it displays as.Code:<?php print_r ($_POST) ?>
Array {
[name] => undefined
}
How can I send the array though ajax?
Thanks
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks