I’m having an issue at the moment which is causing me some headache.
using .ajax / php I pull a option list back into a div that I have created.
Basically a user uses the first dropdown box and selects a car make a second dropdown box appears with the .ajax query models.
When someone then selects their car model I want it to alert the user which model they have selected.
I’m having trouble because I’m already calling the alert function before the injection of has been pulled through.
Hope that makes sense, here is my current code:
<script type="text/javascript">
$(document).ready(function(){
$('.model_id').change(function() {
$.ajax({
type:'POST',
url: 'http://mydomain.net/getmodel.php',
data: { make_id: $('.model_id').val() },
datatype: "html",
success:function(data){
$('.result').html(data);
}
});
});
});
$(success).load(function(){
$('.result').change(function() {
alert('s');
});
});
</script>
change
to
(i.e. remove the $(success) part)