I have an Index.php file that makes an ajax call and loads a php page Within that php page that is loaded using ajax I have a html form. I am trying to do another ajax call from Index.php that if a select box is changed a new ajax call is made.
Everything works fine but the ajax on change for the select box.
I think it has something to do with the fact that the form is loaded in with ajax and the on change is using ajax.
Is this possible to do?
$(document).ready(function() {
$("#message-loading").show();
var dataString = 'id='+ id;
$.ajax
({
type: "POST",
url: "details.php",
data: dataString,
success: function(html)
{
document.getElementById('message-box-body').innerHTML = html;
$("#message-loading").hide();
}
});
This is the select change code
$(".selectbox").change(function()
{
var id=$(this).val();
var dataString = 'id='+ id;
$.ajax
({
type: "POST",
url: "another-page.php",
data: dataString,
cache: false,
success: function(html)
{
$(".another-selectbox").html(html);
}
});
});
The select box is located inside the php page of the first ajax call. The ajax change should load new values for another select box within the first php page.
I have this working if I don't load the php page using ajax.