views:

118

answers:

3

Hi,

I'm trying to implement this specific example using asp.net page instead of asp page. If you look at the example you can see that there are 2 parts for the page:

  1. Mail asp page. This page have JS code that calls other asp file for AJAX use.
  2. the other asp page which holds the JS code.

The responseText of the call is the client side code, so, when I write something like this:

<html><head><title>test</title><script language="javascript" runat="server"
type="text/javascript">function test(){Response.Write("This is a Test!");
</script><body onload="test()"></body></html>

the page ignores my server side code and returns this:

<html><head><title>test</title><body onload="test()"></body></html>

what should I need to do to make him process my JS code and return its output?

Thanks in advance, Oz Radiano.

A: 

asp.net does not process javascript server side, so setting the script tag runat=server with language="javascript" will be mostly ignored.

I think if you change it to "JScript" it will work, however, this has nothing to do with ajax.

"runat = server" says, preprocess this on the server and don't send it to the client. If the language is a processable one it will be evaluated as well.

DevelopingChris
the code of the page consist of AJAX call to this page, with XmlHttpObject, params passed by post command
oz radiano
A: 

Try implementing the example after watching some videos from http://www.asp.net/learn/ajax-videos/ and http://www.asp.net/learn/ajax/

Its very easy to implement AJAX in asp.net then ASP. I can clearly give you the correct source code. :) But you seem to try out new things. Let us know how it goes!

Shoban
Hi, I don't want to use a real aspx AJAX, I'm using aspx only because it's comfortable
oz radiano
A: 

Thanks for your responses, they made me understand that I'm not sure what my problem is.

After failing in implementing this exact example, I've googleed "how to run asp code using ajax"

this result returned and made it very clear.

Thanks again.

oz radiano