I have a jquery as HTML form as below. I am trying to display some documents required and show a div when the user changes the options, depending on the option value.
<select id="constitution_id" class="form_select_constitution">
<option value="1">First</option>
<option value="2">Second</option>
</select>
And the javascript:
$('.form_select_constitution').change(function(){
var cid = $(this).val();
if(cid > 2 ) {
$('#appDiv').show();
}else{
$('#appDiv').hide();
}
data = 'cid='+cid;
url = 'business_documents_available.php';
$.ajax({
type: "GET",
url : url;
data : data,
//dataType: "json",
error:function(resp){
alert('Error !');
},
success: function(resp){
alert(resp);
//show_docs(resp);
}
});
});
function show_docs(resp) {
//$('.json_resp_docs').html(resp.documents);
}
And the business_documents_available.php
is :
<?php
include_once('include/config.php');
include_once('validate.php');
include_once('applicants.php');
$cid = $_GET['cid'];
$sql = "SELECT * FROM doc_vehical_loan_list WHERE constitution_type = '$cid'";
$result = $db->executeQuery($sql);
$result_json = json_encode($result);
//var_dump($result_json);
//return $result_json;
return 'HII';
?>
Though showing and hiding the div id appDiv
is working , I am not getting any alert from the ajax response ! Whats happening?