Saturday, November 28, 2009

Re: [jQuery] values a serializeArray() on the server

Solved my own mystery. I was using the wrong #id in the serializeArray()
line. Should be:
$('#response').load('response.php', $("#form1").serializeArray()); NOTE the
$("#form1").serializeArray()...
I had this as $('#response').serializeArray().

Sorry for the posts. Too tired, I should have caught this before I first
posted.

YankeeFan wrote:
>
> Greetings all,
> I'm trying to learn myself about the load() function using
> serializeArray(). But when I send my form data to a server script for
> processing, I do not know how to access the data sent by my form. I've
> tried $_REQUEST, $_POST, and $_GET but all seem to be empty.
>
> My code is short and just for self learning purposes:
>
> HTML page (in part):
>
> <script type="text/javascript" src="jquery/jquery-1.3.2.min.js"></script>
> <script type="text/javascript">
> // Your code goes here
> $(document).ready(function(){
> $('#submit').bind('click', function(){
> $('#response').load('response.php',
> $("#response").serializeArray());
> });
> });
> </script>
>
> <div>
> <form id="form1">
> Name: <input name='fname' id="fname" size="20" /><br />
> Age: <input name='age' id="age" size="20" /><br />
> <input type="button" id="submit" value="Submit" />
> </form>
> </div>
>
> <div id="response"></div>
>
> ----
> On resourse.php, how do I access what gets sent via the serialize array.
> A simple code snippet would help. Right now, I have no code other than
> trying to print the values sent. I can do simple
> <?php print "hello world"; ?>
> and it shows in my #response div, so my connection is working. I just
> don't know how to get the contents of the serializeArray().
>
> Thanks
>
>
>

--
View this message in context: http://old.nabble.com/values-a-serializeArray%28%29-on-the-server-tp26558469s27240p26558470.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

No comments: