减慢功能

My website can be found here and I'm stumbling across one issue in particular now. I thought that the functions weren't running in order and had to fix some issues in my own code. Now when the page is refreshed, I see the year being selected and then I see the "make" box changes to "LOADING..." right before it's changed to 'Acura'. The problem is that I think the the 'click' and 'change' for that drop-down are happening before it's changed the value over.

Just so it's clear, the simulation of the click and change is there so that the change event for this Prototype widget is triggered. jQuery is unable to do this by itself, since it was built in Prototype.

My code:

function yearChange()
{
    jQuery("#finder-72--424").val('13080187').change();
    $('finder-72--424').simulate('click');
    $('finder-72--424').simulate('change');
}

function makeChange()
{
    jQuery("#finder-72--425").val('13097610').change( function() {
        $('finder-72--425').simulate('click');
        $('finder-72--425').simulate('change');
    })
}

yearChange();
makeChange();

This is more of an answer to the question than a solution to the problem, but you could either call makeChange() at the end of your yearChange() function, or you could set a timer on the makeChange() call for a split second, might be just enough time to let these execute in the correct order:

yearChange();
setTimeout(makeChange, 200); // 200 ms

Why not make those two functions work together so that a callback triggers the second event you want. Have you looked at jQuery promise() ?

$('#selector').promise().done(function() { /* Do something */ });