473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Calling server site script from Javascript using ATLAS

Hi All,

I'm new to Atlas and I did some programming using AJAX, but I'm
wondering if it is possible to hava a javascript which can call a
server-site function, in my case to write data to the cache, using
AJAX. So I'm not looking for a possibility to wrap-up controls, but
just to call server-site code from ATLAS.

I know this can be done using AJAX, so in my opinion this should also
be possible using ATLAS, or can ATLAS just be used to wrap up controls?

Thx for replies.

Sep 23 '06 #1
4 2021
Yes, this can certainly be done using Atlas.
Atlas can call web services that you write via AJAX.

Here are the details:
http://atlas.asp.net/docs/atlas/doc/...consuming.aspx

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
<s.*******@symax.nlwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hi All,

I'm new to Atlas and I did some programming using AJAX, but I'm
wondering if it is possible to hava a javascript which can call a
server-site function, in my case to write data to the cache, using
AJAX. So I'm not looking for a possibility to wrap-up controls, but
just to call server-site code from ATLAS.

I know this can be done using AJAX, so in my opinion this should also
be possible using ATLAS, or can ATLAS just be used to wrap up controls?

Thx for replies.

Sep 24 '06 #2
Hi Steve,

thanks for the reply, but is developing a webservice for such a small
function not a little overkill. Of course I can combine AJAX and ATLAS.
Just a simple function for writing to the cache using an AJAX dll and
for controls use ATLAS.


Steve C. Orr [MVP, MCSD] schreef:
Yes, this can certainly be done using Atlas.
Atlas can call web services that you write via AJAX.

Here are the details:
http://atlas.asp.net/docs/atlas/doc/...consuming.aspx

--
I hope this helps,
Steve C. Orr
MCSD, MVP, CSM
http://SteveOrr.net
<s.*******@symax.nlwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
Hi All,

I'm new to Atlas and I did some programming using AJAX, but I'm
wondering if it is possible to hava a javascript which can call a
server-site function, in my case to write data to the cache, using
AJAX. So I'm not looking for a possibility to wrap-up controls, but
just to call server-site code from ATLAS.

I know this can be done using AJAX, so in my opinion this should also
be possible using ATLAS, or can ATLAS just be used to wrap up controls?

Thx for replies.
Sep 24 '06 #3
Hi,

s.*******@symax.nl wrote:
Hi Steve,

thanks for the reply, but is developing a webservice for such a small
function not a little overkill. Of course I can combine AJAX and ATLAS.
Just a simple function for writing to the cache using an AJAX dll and
for controls use ATLAS.
The simplest implementation of AJAX in .NET is using ASHX Custom
HttpHandlers. It's very simple: In your web site or web application
project, Add New Item / Generic handler.

Then, in the code behind, implement the methods (Studio 2005 gives you a
template).

From the client, use JavaScript and XmlHttpRequest to send the request
and read the response. There are many tutorial online.

Example for a simple asynchronous request:

var oHttp = null;
if ( window.XMLHttpRequest )
{
oHttp = new window.XMLHttpRequest();
}
else
{
if ( window.ActiveXObject )
{
oHttp = new window.ActiveXObject( "Microsoft.XMLHTTP" );
}
else
{
throw "UNSUPPORTED PLATFORM";
}
}
if ( !oHttp )
{
throw "Cannot create XmlHttpRequest";
}

var strQuery = "?param1=value1&param2=value2";
oHttp.open( "GET",
"myHandler.ashx" + strQuery,
true ); // true = async, false = sync

oHttp.onreadystatechange = function()
{
if ( oHttp.readyState == 4 )
{
oHttp = null;
fnCallback( oHttp );
}
}

oHttp.send( null );

Code behind:

In ProcessRequest, use the "context" parameter to extract the
QueryString, and then you can process according to the parameters.

For the Response, if you want to send XML code back, make sure to set
context.Response.ContentType = "text/xml; charset=utf-8";

To save an XML document to the response, use
docResponse.Save(
new XmlTextWriter( context.Response.OutputStream,
context.Request.ContentEncoding ) );
In the JavaScript, the XML code will be available in oHttp.responseXML.
The response is also available in plain text in oHttp.responseText. Also
check the oHttp.status, which contains status like 200 (OK), 500 (Server
error), etc...

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 24 '06 #4
Hi Laurent,

thx for the reply. I read some article on the Inet. I was thinking in
the same direction. User ATLAS for the teriffic controls and an AJAX
lib (or CallbackEventHandler but this is limited for IE) for the other
stuff.

Again, thanks guys.


Laurent Bugnion schreef:
Hi,

s.*******@symax.nl wrote:
Hi Steve,

thanks for the reply, but is developing a webservice for such a small
function not a little overkill. Of course I can combine AJAX and ATLAS.
Just a simple function for writing to the cache using an AJAX dll and
for controls use ATLAS.

The simplest implementation of AJAX in .NET is using ASHX Custom
HttpHandlers. It's very simple: In your web site or web application
project, Add New Item / Generic handler.

Then, in the code behind, implement the methods (Studio 2005 gives you a
template).

From the client, use JavaScript and XmlHttpRequest to send the request
and read the response. There are many tutorial online.

Example for a simple asynchronous request:

var oHttp = null;
if ( window.XMLHttpRequest )
{
oHttp = new window.XMLHttpRequest();
}
else
{
if ( window.ActiveXObject )
{
oHttp = new window.ActiveXObject( "Microsoft.XMLHTTP" );
}
else
{
throw "UNSUPPORTED PLATFORM";
}
}
if ( !oHttp )
{
throw "Cannot create XmlHttpRequest";
}

var strQuery = "?param1=value1&param2=value2";
oHttp.open( "GET",
"myHandler.ashx" + strQuery,
true ); // true = async, false = sync

oHttp.onreadystatechange = function()
{
if ( oHttp.readyState == 4 )
{
oHttp = null;
fnCallback( oHttp );
}
}

oHttp.send( null );

Code behind:

In ProcessRequest, use the "context" parameter to extract the
QueryString, and then you can process according to the parameters.

For the Response, if you want to send XML code back, make sure to set
context.Response.ContentType = "text/xml; charset=utf-8";

To save an XML document to the response, use
docResponse.Save(
new XmlTextWriter( context.Response.OutputStream,
context.Request.ContentEncoding ) );
In the JavaScript, the XML code will be available in oHttp.responseXML.
The response is also available in plain text in oHttp.responseText. Also
check the oHttp.status, which contains status like 200 (OK), 500 (Server
error), etc...

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Sep 25 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Adam Atlas | last post by:
(Apache/2.0.55, PHP/4.4.1) I am using an "Action" directive in my Apache configuration to map a certain file type (by means of AddType and AddHandler) to a PHP script. I wasn't sure if this would...
4
by: KK | last post by:
Hi, Does anybody know how to call server side function in javascript? Suppose I've a method named Test() at code behind of ASP.Net page. How can I call that method in javascript function ???...
3
by: Steve Kershaw | last post by:
Hi, I need to fire a server side button click event from my client side javascript. The client side javascript code follows: <script language="javascript" type="text/javascript"> function...
2
by: pamelafluente | last post by:
Hi dears, I have a plain HTML page. I want to render it a little interactive. I was thinking to add to it 1 script and events to the elements I want to make interactive. Then, I need to...
0
by: Daniel | last post by:
I wrote a pretty neat website today that can utilize no postback AJAXIAN type features. Basically to populate a drop down with a web service call that hits a SQL server, based off the change of...
9
by: lanem | last post by:
I installed atlas on my dev machine and everything works great. When I try to get it working on the server, I get this error when building the page: "Request for the permission of type...
5
by: =?Utf-8?B?Q2FybG8gRm9saW5p?= | last post by:
Hi, I'm starting studying ATLAS. First thing that I'm concerned about is if the ATLAS controls are a pluggable options for server side controls.. What I wonder is if the case ATLAS extension are...
4
by: gengyue | last post by:
Hi, I need to call .Net webservice from my JSP page. My application is Struts application. It is deployed on Oracle application server. Here is the whole process. I have a login form. When user...
4
by: gengyue | last post by:
Hi, I need to call .Net webservice from my JSP page. My application is Struts application. It is deployed on Oracle application server. Here is the whole process. I have a login form. When user...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.