I have a php file called by ajax, where I printed an array, and I want to get the array in the ajax success event and use as javascript array to prepend as valu in two fields with jquery. I tried it as bellow but failed. actually I am new in coding, Pls help me any one....
the php file is as bellow:
$qry = $crud->select("latest_event", "bnDescription, eventHeading","eventID='{$eventID}'");
$data = mysql_fetch_assoc($qry);
$arr = array("content" =>$data['bnDescription'], "heading" => $data['eventHeading']);
header('Content-type: application/x-json');
echo json_encode($arr);
?>
the javascript is:
$.ajax({
type: "POST",
url: "getEventData.php",
data:"eventID="+eventID+"&lang="+lang,
cache: false,
success: function(data){
$("input#eventHeading").prepend(data[heading]);
$("textarea#cont").prepend(data[content]);
}
});