Jump to content

function not running on page load


fife

Recommended Posts

I have this function that i have found and implemented.  It belongs to a dual drop down an refreshes the second dropdown base on the first one.

 

The function works fine but not when the page is first loaded.  I does not show anything.  I have to select an item out of the first drop down to refresh this second one into working.  Is there anyway I can mkae the second one work correctly straight away?

<script type="text/javascript" charset="utf-8">
function get_cities(networks)
{
    $.ajax({
       type: "POST",
       url: "select.php", /* The country id will be sent to this file */
       beforeSend: function () {
      $("#folder").html("<option>Loading ...</option>");
        },
       data: "idnetworks="+networks,
       success: function(msg){
         $("#folder").html(msg);
       }
       });
} 
</script>

 

The function only works

Link to comment
https://forums.phpfreaks.com/topic/265880-function-not-running-on-page-load/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.