views:

29

answers:

2

In my following code, I am calling function "Make Request" that is located in a separate .js file. But the control is not reaching to this function. I have also added the link to the related file.

<link rel="section" href="../Lib/ajaxhandler.js" type="text/javascript">

<td oncontrolselect="MakeRequest('inCategory','SELECT * FROM electioncategorymaster', 'ecid', 'ecname');">
    <select id="inCategory" name="inCategory" class="entryFormInputBoxColor">

    </select>
</td>

I want to make a call to the MakeRequest function when page is rendered. On which event I must call the function?

+1  A: 

Your link to the script is wrong. The link tag is useful for e.g. stylesheets.

Your script tag should be like this:

<script src="../Lib/ajaxhandler.js" type="text/javascript"></script>

Also, you may want to catch the oncontrolselect event of the combo box instead of the td.

Patonza
+1  A: 

How about this...

<script src="../Lib/ajaxhandler.js" type="text/javascript"></script>

<td>
    <select id="inCategory" name="inCategory" class="entryFormInputBoxColor" 
            onChange="MakeRequest('inCategory','SELECT * FROM electioncategorymaster', 'ecid', 'ecname');">

    </select>
</td>
Ei Maung
@Ei: It's not working well on Change, but works well on MouseAbove.
RPK