Pause jQuery until function has ran.

Pause jQuery until function has ran.

Hi Guys,

I'm having a little problem.

Basically I'm loading a option list from an .ajax post:

  1.     <script type="text/javascript">

  2.     $(document).ready(function(){
  3.       $('.model_id').change(function() {
  4.             $.ajax({
  5.                 type:'POST',
  6.                 url: 'http://mydomain.net/getmodel.php',
  7.                 data: { make_id: $('.model_id').val() },
  8.                 datatype: "html",
  9.                 success:function(data){
  10.                     $('.result').html(data);
  11.                 }
  12.             });
  13.         });
  14.       });
  15. </script>
Once I have done the above and the user selects another drop down list I want to alert the user with the value.

But it doesn't seem to want to work:

  1.     $(document).ready(function(){
  2.       $('#model_name').change(function() {
  3.             alert($('#model_name).val());
  4.         });
  5.       });
The #model_id gets loaded from the first query.

Can anyone shed any light.

Thanks,

Scott