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:
- <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);
- }
- });
- });
- });
- </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:
- $(document).ready(function(){
- $('#model_name').change(function() {
- alert($('#model_name).val());
- });
- });
The #model_id gets loaded from the first query.
Can anyone shed any light.
Thanks,
Scott