Hey guys How do I use the PHP variable $contact['id'] in my ajax call? I'm trying to create a page that retrieves all notifications associated with a user. When the page load I already know the id of the user, how do I use this parameter in my ajax calls from the beginning? At the moment I am using the php preprocessor by splitting up the php string and inserting the variables but I know this isnt a particularly good solution and doesnt for example allow me to refactor the javascript out into its own file. I am using the Zend PHP Framework by the way. Anyone know how best to achieve what I am trying to do?
<?php $this->headScript()->appendScript('
dojo.require("dijit.form.Textarea");
function getNotes(){
dojo.xhrGet({
url: "/manager/contacts/get-notes-html",
content: {
"contactId" : '.$this->contact['id'].',
},
load: function(response) {
console.log("Form successfully submitted");
dojo.byId("notesDiv").innerHTML = response;
},
error: function() {
console.error("Error on submission");
alert("error error errrrror");
}
});
}
dojo.addOnLoad(getNotes);
');
?>
<div id="notesDiv">
</div>