I am passing the data from ajax process page as
<?php header('Content-Type: application/json; charset=utf-8'); $response = array("username" => "alpha", "message" => 'Passed.', "divid" => 5); echo json_encode($response); ?> In source page I need to collect divid to display the username and message in respective div
success:function(data) { var obj = $.parseJSON(data); var k = obj[0].divid; $('....calling_by_id according to value of k..').html(data.username); $('calling_by_id according to value of k').html(data.message); $('.success').fadeIn(200).show(); }