Can somebody can tell me why my code will suddenly callback to error and suddenly can successful randomly?Thanks.
function get_timeframe(){
var v_fldname = "xUPH_exclude_Timeframe";
if ($.trim(v_fldname) != '') {
//alert(v_fldname);
$.ajax({
url:"../ajax/get_timeframe.php",
dataType: "json",
data:{v_fldname: v_fldname},
success: function(data) {
if ( data.result != null ) {
$.each(data.result, function(){
var code_value = this['code_value'];
document.getElementById('v_xUPH_exclude_Timeframe').value = code_value;
//alert(" get v_xUPH_Scan_Count");
});
}
},
error: function(data) {
alert("get_timeframe error");
}
});
}
}
The following php code.
if (isset($_REQUEST['v_fldname']) === true) { require '../Connections/con_meditop.php';
$query = mysql_query("
SELECT code_mstr.code_value
FROM code_mstr
WHERE code_mstr.code_fldname = '" . mysql_real_escape_string(trim($_REQUEST['v_fldname'])) . "'
");
$result = array();
if(mysql_num_rows($query) == 0)
{
$result = null;
}else{
while ( $row = mysql_fetch_array($query) )
array_push($result, array('code_value' => $row[0]));
echo json_encode(array("result" => $result));
}
}