hi, how do you call php function that is in a different file from a javascript function.
I have a javascript function that recieves a variable frm an onclick function. The varaible is an id that I will use to retrieve data from mysql database. The variable is then pass on to php function that will access the database to get the data and return back to my js function for display, but it does seem to be working. how can i get it to work?? I am using codeigniter php.
here is code
javascript in a different file called divUpdate.php
<script type="text/javascript">
function changeDiv(venueID){
//retrieveData(venueID) is php function from venue_model.php
var dest = retrieveData(venueID);
document.getElementById('venue_description').innerHTML=dest;
}
</script>
---where the onclick function calls the javascript above ----
<li><a href="#self" class="menulink" class=&{ns4class};
onClick="changeDiv(\''.
$venue_details->VenueID.
'\')">;
--- function the is called from javascript above this is in the model(codeigniter)--
function retrieveData($venueID){
$query = $this->db->query("SELECT * FROM venue WHERE VenueID = '$venueID' ");
echo $query;
}