I'm getting a value of a variable using a JQuery function.
<script>
$( "#DivisionIDdetails3" ).change(function() {
var A=$( "#DivisionIDdetails3" ).val();
var ajax = ajaxObj("POST", "XXXXXX.php");
ajax.onreadystatechange = function() {
if(ajaxReturn(ajax)== true) {
if(ajax.responseText != "The User Type was added successfully"){
status.innerHTML = ajax.responseText;
alert (ajax.responseText);
} else {
//window.scrollTo(0,0);
form.innerHTML = "OK "
}
}
}
ajax.send("A="+A+"&B="+B);
});
</script>
Then I need to sent this value A, to a php file which is written inside the same html page. This is the place where I need to send it.
<html>
<body>
<select class="UserTypeTextBox" id="DivisionIDdetails4" name="DivisionText4" style="position:absolute; left:250px; top:200px;height:23px;width:250px;">
<?php
$result = mysqli_query($con,"SELECT Division_Name FROM Division_Details WHERE Division_Type=''");
while($row = mysqli_fetch_array($result)){
echo "<option>$row[Division_Name]</option>";
}
?>
</select>
<html>
<body>
These are the questions I faced.
1) I suppose I need to use an Ajax function to send it to the PHP code. But how can I name the piece of the PHP file. How can I give a name to it?
2) Could someone please help me in using the ajax function to sent the variable value to the code.
3) I used code of an AJAX as above. But how can I access the PHP file I should use.
);in your change function.XXXXXX.phpthen return it into ajax and put it insideselectelement..