Chris,

The hash idea that the other site was talking about is what I was telling
you in my previous post. I do this all the time:

function myFunction(email){
   var args = {};
   args.name = $('#nameid').val();
   args.location = $('#locationid').val();
   args.email = email;
   args.someStringLiteral = "I am a string!";

   $.ajax({
      url:"updatesql.php",
      type:"post",
      data: args,
      error:function(){
         alert('Failed');
      },
      success:function(){
         alert('Success');
      }
   });
}

Note that in JavaScript what a hash (or what I would call a structure) is
also an associative array, and it's an object, and both can be accessed
using either dot or array notation. So if you had an object
(hash/structure/associative array) called 'session' you could access the
'loggedin' property by saying session.loggedin or session['loggedin']. You
could set up that hash/associative array/struct/object as I've mentioned
above:

var session = {};
session.loggedin = true;

or

var session = {"loggedin":true};

Check this excellent page (http://www.quirksmode.org/js/associative.html)
for much more detailed information. :o)

jQuery will take an object like this and translate it into the
"name=John&location=Boston" for you. I find passing an object of arguments
easier and more preferable (personally) than passing
"name=John&location=Boston".

Chris

On Fri, Apr 11, 2008 at 3:57 PM, Scott Sauyet <[EMAIL PROTECTED]> wrote:

>
> Chris Jones wrote:
>
> > The hash was a suggestion on another site. I have tried it without it as
> > well but no joy. If I alert the "serial" on success I get what I would
> > expect ie. item[]=2&item[]=3&item[]=10
> >
> > [ ... ]
> > data: serial.hash or data: serial, = nothing gets updated.
> > data: "name=John&location=Boston" = the table gets updated via
> > updatesql.php
>
> Is that "on success" based upon the AJAX "success" function?
>
> If so, then your PHP is actually responding with a good error code, and
> you need to do some fiddling in the PHP to see what's happening.
>
> If you don't get that far, I would suggest something like the
> LiveHTTPHeaders plugin for Firefox to do some testing on the client side.
>
> Sorry I don't have more definitive answers.  Good luck,
>
>  -- Scott
>



-- 
http://cjordan.us

Reply via email to