PHP Unpack object

Hey guys,

I have just used JQuery to return an array to my php script via GET and when I echo what I returned it says [object Object]. Anyone have any idea how I can unpack this and get something useful from it?

thanks

Hi Silv,

Can you show the code please so we can get an idea of whats going on?

are you using json_decode() to unpack the json?

It doesn’t look as though you’re sending across a proper representation of the object but rather just [object Object]. Can we see the JavaScript that you use to send the object over to the PHP script?

Hey apologies guys I haven’t been getting email notification of replies from sitepoint lately so sorry to any of you whanging for who have been left hanging for an answer.

No need for apologies, it’s your thread to participate in! However, some answers would be nice. (:

ok here you go,

My JQuery gets all of the input box data onclick:

$('#checkout').click(function()

 {
    $inputs.each(function() {
        values[this.name] = $(this).val();
		
    });
	$.ajax({ 
		type: 'GET',
		url: 'index.php?route=payment/check/confirm',
		data: {id:'test', id2:values},
		success: function() {
			location = '<?php echo $continue; ?>';
		}		
	});
});

In my php script (at the url above):

$result.= $_GET[‘id’]; gives me ‘test’

but

$_GET[value]; gives me [object Object]

I want to know how to access what is inside this object?

_GET is only two-dimensional, try POST instead :slight_smile:

Thanks Ruben :wink: u the man