I have this script code and it works perfectly,
CODE
<script>
function ajob(){
var a3=a.value
var a4=b.value
var a5=c.value
if(a3!='' && a4!=''){
$.ajax({
type:"get",
url:"addj.php?content=" + a3 + "," + a4 + "," + a5
});
lod();
}else{alert('Fill all fields')}
}
</script>
<form>
<table>
<tr><td>Job Name:</td>
<td><input id="a" name="jname" type="text"></td>
</tr>
<tr><td>Job Description:</td>
<td><input id="b" name="jd" style="margin: 2px 0 2px 0;" type="text"></td>
</tr>
<tr><td>Status:</td>
<td>
<select id="c" name="jstat" style="width:100%; height: 26px" >
<option>Active</option>
<option>Not Active</option>
</select>
</td>
</tr>
</table>
</form>
what i want to know is how can can i know if there is an error in my addj.php
file? Here is my addj.php
addj.php
require 'con.php';
$pieces = explode(",", $_GET['content']);
$jname=$pieces[0];
$jd=$pieces[1];
$jstat=$pieces[2];
$query=mysqli_query($con,"INSERT INTO job(job_name,job_desc,status) values('$jname','$jd','$jstat') ");
How do I return a failed status from my PHP code and how can I handle that error in my java script code?