The $.load is executed only when the getResults() function is called.
And you're calling it on document load.

The first line:
$('#PowerPipeConfigurations').change(function(){ getResults
(); }).change();

You're setting a callback onchange, and then you're calling: .change
();
This is executing the callback and thus, executes getResults().

I'm not sure why you're adding the .change(), .blue(), etc. at the
end.
You probably just want:
$('#PowerPipeConfigurations').change(function(){ getResults(); });

On Jun 17, 5:26 am, Greg F <g...@libertyhosting.net> wrote:
> Hi,
>
> This script (below) is firing at page load. Are there any ideas how
> not to get it to fire until and event happens. Thanks for the help.
>
> Greg
>
> $(document).ready(function () {
> if($('#DrainStackDiameter').val() != null){
> $('#PowerPipeConfigurations').change(function(){ getResults
> (); }).change();
> $('#TotalApartmentsServed').blur(function(){ getResults(); }).blur();
> $('#TotalWashroomsPerApartment').blur(function(){ getResults(); }).blur
> ();
> $('#TotalPowerPipeUnits').blur(function(){ getResults(); }).blur();
> $('#DrainStackLength').blur(function(){ getResults(); }).blur();
> $('#DrainStackDiameter').change(function(){     getResults(); }).change();}
>
> function getResults(){
>          var params = {
>        PowerPipeConfigurations: $('#PowerPipeConfigurations').val(),
>            TotalApartmentsServed: $('#TotalApartmentsServed').val(),
>            TotalWashroomsPerApartment:$('#TotalWashroomsPerApartment').val
> (),
>        TotalPowerPipeUnits: $('#TotalPowerPipeUnits').val(),
>        DrainStackLength: $('#DrainStackLength').val(),
>        DrainStackDiameter: $('#DrainStackDiameter').val()
>      };
>
>          $('#RecommendedPowerPipeModel').load('recommend.php',params);
>
> }

Reply via email to