Robin Hair
I'm using the following Javascript in Sourcerer, to refresh a DropDown form control, by running some PHP code on the server:
<script type="text/javaScript">
function FetchState(id){
jQuery('#state').html('<option></option>');
jQuery('#city').html('<option>Select City</option>');
jQuery.ajax({
type:'post',
url: 'phpcode2/ajaxdata.php',
data: { country_id : id},
success: function(data){
jQuery('#state').html(data);
}
})
}
My ajaxdata.php code should return 'State' data according to the selected country_id. However, it won't let me execute any database code and continually returns 500 (Internal Server Error). [This isn't a syntax problem as I have tested the code externally and even broken it down to just a single line of code!].
My questions are:
1) Is the above use of javascript linking server side php code a limitation of Sourcerer?
2) Is my javascript URL the correct way to run the .php code?
3) My ajaxdata.php code is just a file on the server, does it need to be 'packaged' within a Joomla Module or PlugIn for the database calls to work?
Thanks
Robin Hair