Calling aspx page from htm file

R

Ravi

Hi,
I am trying to call an aspx page from an htm file.
I have written something like this in my htm file

<script src="Test.aspx"></script?

The Test.aspx page should call a javascript function and should show an
alert.

How can i acheive it. If I call the aspx file directly it works as
expected but not from htm file.

I tried using <img src="Test.aspx"> but again no luck.

Any help, appreciated.
 
L

Laurent Bugnion

Hi,
Hi,
I am trying to call an aspx page from an htm file.
I have written something like this in my htm file

<script src="Test.aspx"></script?

The Test.aspx page should call a javascript function and should show an
alert.

How can i acheive it. If I call the aspx file directly it works as
expected but not from htm file.

I tried using <img src="Test.aspx"> but again no luck.

Any help, appreciated.

You need to understand how the web works. The server and the clients are
two totally different worlds, they run in different processes, under
different conditions, often on different machines.

The only thing that the server can do is send some text (and in some
cases binary files) to the client. How this text is executed is purely a
client-side matter, and the server has no idea what will happen to that
text.

In your first example, if the page Test.aspx delivers JavaScript code
(which is nothing else than text to the server), and if it delivers it
with the correct MIME type, then the browser will attempt to interprete
the script. What action it takes after that totally depends on what
script code you send back to the client. It is absolutely impossible
that the "Test.aspx page should call a javascript function and should
show an alert", because the server just sends text back to the client.
From the client's point of view, what happens here is exactly the same
than if you had set Test.js in the SRC instead of Test.aspx.

In other words, it is impossible to help you without seeing the output
of the Test.aspx page, without making sure that the MIME types are set
correctly, and without knowing more about the rest of your client-side code.

The second example worries me, because it makes no sense at all. What
kind of effect do you expect by passing some text data to an object
which expects a binary output?

HTH,
Laurent
 
B

bruce barker \(sqlwork.com\)

as long as the asp file only returns javascript code (no html) it should
work.


<@ Page language="C#">
alert('hi');

the above page should work

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top