What do you mean a "PHP object"? You can't pass a PHP object in
Javascript...Javascript is Javascript, not PHP.
You can pass in a Javascript object (JSON format) to jQuery's ajax()
and it'll convert accordingly for you depending on whether you're
doing a GET or POST.

This below, is the same way to write what you have but using a
Javascript object for the request data.

$.ajax({
   type: "POST",
   url: "some.php",
   data: {name:'John', location:'Boston'},
   success: function(msg){
     alert( "Data Saved: " + msg );
   }
 });

On Aug 25, 9:08 am, Stefanos <grbo...@gmail.com> wrote:
> Hello everyone!
>
> By writing this:
> $.ajax({
>    type: "POST",
>    url: "some.php",
>    data: "name=John&location=Boston",
>    success: function(msg){
>      alert( "Data Saved: " + msg );
>    }
>  });
>
> we pass variables 'name' and 'location' to the file 'some.php'. How
> can we pass a PHP object????
>
> Thank you in advance!

Reply via email to