I have a ASPX file to process some validation from my users. I need to prepear some codes and IDs for user to work with my data. I wrote a Validation.aspx file, checking everything about my users in Page_Load
. I want to use some javascript functions from html files.
There are some javascript functions inside ASPX file, I make them in runtime from gathering data by validation.aspx Page_Load
.
I want to put a script inside html files like this:
<script src="validation.aspx?a=1234" type="text/javascript" language="javascript" ><script/>
<script> RunValidationAnswer(); <script/>
The RunValidationAnswer();
function is made in runtime form user data (retriving from QueryString [a=1234] ). I can't access RunValidationAnswer();
in html files.
If i put the RunValidationAnswer();
in a JS file I can access it but I lose the powerfull operations inside Page_Load
of aspx file.
plz help me to find a way to solve my problem.
I wrote this sample script in Validation.aspx
<script type="text/javascript" language="javascript">
function RunValidationAnswer()
{
alert("hi");
}
<script/>
It is compeletely accessible inside validation.aspx but I can't access this function from other files.
I want somthing like this inside other files:
<script src="validation.aspx?a=1234" type="text/javascript" language="javascript" ><script/>
<script> RunValidationAnswer(); <script/>
Did you set the content type of ASPX page to be javascript so the browser would know that is Javascript file, cause by default the content type of any aspx is HTML
** add ; for C#
Validation.aspx should be empty file except for this line
And in code file, you write JS by response.write
You could also just use ASPX page -without code file- like this