Welcome Guest, Not a member yet? Register   Sign In
Send post receive json
#1

[eluser]umbungo[/eluser]
Code:
$('span').click(function(){
    $.post("/", {'command': $(this).attr('id')}, function(data){
        alert(data.key)
    }, 'json');
});
The problem when i do this is that the 'post' is sent as json and not in the normal manner, but if i omit the 'json' note then the post section works but gives back a string which isn't interpreted as json. (i'm using json_encode on the PHP side)




Theme © iAndrew 2016 - Forum software by © MyBB