request
Code: Select all
new Ajax.Request('ajax.php',
{
asynchronous:true,
method: 'post',
postBody: 'action=load_block&block_select=' + show_name,
onSuccess: function(transport)
{
alert('TEST1'); // this gets alerted
var response = transport.responseText || null;
alert(response); // shows the json below...
var data = eval("(" + response + ")");
alert('TEST2'); // this does not
},
onFailure: function()
{
alert('Something went wrong...');
}
});Code: Select all
{
"0":[
"name":"Apacalypto",
"id":"8",
"duration":"149"
],
"1":[
"name":"Apacalypto",
"id":"9",
"duration":"149"
],
"2":[
"name":"Alpha Dogg",
"id":"10",
"duration":"148"
],
"3":[
"name":"Alpha Dogg",
"id":"11",
"duration":"148"
],
"4":[
"name":"Alpha Dogg",
"id":"12",
"duration":"148"
]
}