Note, I am not trying to use the Microsoft AJAX Framework, yes I am
aware of what it is and what it does.... The techniques refered to as
"AJAX" predate this toolkit and ASP.NET 2.0
What I am trying to accomplish is the most minimal cross-platform web
browser "AJAX" implementation using .NET 2.0, here is what I have so
far in the client and the server.
When the user clicks in Internet Explorer this does exactly what I
would expect, I get a JavaScript alert box with the data I pass in to
SendIt.aspx saying JAMES1.
So the problem is this doesn't work from other web browsers, I tried
with Safari for Windows as well as FireFox 2.0 and the alert box never
appears, it seems the XMLHttpRequest object does not work in non-IE
browsers.
CLIENT (this page has an .HTML extenshion on the web server)
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<script language=javasc ript>
function submitForm()
{
var xhr;
try { xhr = new XMLHttpRequest( ); }
catch(e)
{
xhr = new ActiveXObject(M icrosoft.XMLHTT P);
}
xhr.onreadystat echange = function()
{
if(xhr.readySta te == 4)
{
if(xhr.status == 200)
{
var x1 = xhr.responseTex t;
alert(x1);
}
else
{
alert("failed") ;
}
}
};
xhr.open("POST" , "http://localhost:2160/WebSite1/SendIt.aspx",
true);
xhr.send("JAMES 1");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<button id="Button1" value="start2"
onclick="submit Form();">Test2</button>
</div>
</form>
</body>
</html>
SERVER (here is the Page_Load event from the ASPX page)
protected void Page_Load(objec t sender, EventArgs e)
{
string txt = "";
string input = null;
StreamReader sr = new StreamReader(Re quest.InputStre am);
while ((input = sr.ReadLine()) != null)
{
txt += input;
input = null;
}
sr.Close();
sr.Dispose();
//Request.SaveAs( @"c:\temp2\requ est.txt", true);
Response.Write( txt);
Response.End();
} 4 1551
not all browsers use new ActiveXObject(M icrosoft.XMLHTT P) http://www.w3schools.com/dom/dom_http.asp
On Sep 11, 10:02 am, JDeats <Jeremy.De...@g mail.comwrote:
Note, I am not trying to use the Microsoft AJAX Framework, yes I am
aware of what it is and what it does.... The techniques refered to as
"AJAX" predate this toolkit and ASP.NET 2.0
What I am trying to accomplish is the most minimal cross-platform web
browser "AJAX" implementation using .NET 2.0, here is what I have so
far in the client and the server.
When the user clicks in Internet Explorer this does exactly what I
would expect, I get a JavaScript alert box with the data I pass in to
SendIt.aspx saying JAMES1.
So the problem is this doesn't work from other web browsers, I tried
with Safari for Windows as well as FireFox 2.0 and the alert box never
appears, it seems the XMLHttpRequest object does not work in non-IE
browsers.
CLIENT (this page has an .HTML extenshion on the web server)
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<script language=javasc ript>
function submitForm()
{
var xhr;
try { xhr = new XMLHttpRequest( ); }
catch(e)
{
xhr = new ActiveXObject(M icrosoft.XMLHTT P);
}
xhr.onreadystat echange = function()
{
if(xhr.readySta te == 4)
{
if(xhr.status == 200)
{
var x1 = xhr.responseTex t;
alert(x1);
}
else
{
alert("failed") ;
}
}
};
xhr.open("POST" , "http://localhost:2160/WebSite1/SendIt.aspx",
true);
xhr.send("JAMES 1");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<button id="Button1" value="start2"
onclick="submit Form();">Test2</button>
</div>
</form>
</body>
</html>
SERVER (here is the Page_Load event from the ASPX page)
protected void Page_Load(objec t sender, EventArgs e)
{
string txt = "";
string input = null;
StreamReader sr = new StreamReader(Re quest.InputStre am);
while ((input = sr.ReadLine()) != null)
{
txt += input;
input = null;
}
sr.Close();
sr.Dispose();
//Request.SaveAs( @"c:\temp2\requ est.txt", true);
Response.Write( txt);
Response.End();
}
i don't see an error in your code. try:
xhr.open("POST" , "SendIt.aspx",t rue);
in case the port is wrong. instead of try/catch you can also use:
var xhr = window.XMLHttpR equest ?
new XMLHttpRequest( )
: new ActiveXObject(M icrosoft.XMLHTT P);
-- bruce (sqlwork.com)
JDeats wrote:
Note, I am not trying to use the Microsoft AJAX Framework, yes I am
aware of what it is and what it does.... The techniques refered to as
"AJAX" predate this toolkit and ASP.NET 2.0
What I am trying to accomplish is the most minimal cross-platform web
browser "AJAX" implementation using .NET 2.0, here is what I have so
far in the client and the server.
When the user clicks in Internet Explorer this does exactly what I
would expect, I get a JavaScript alert box with the data I pass in to
SendIt.aspx saying JAMES1.
So the problem is this doesn't work from other web browsers, I tried
with Safari for Windows as well as FireFox 2.0 and the alert box never
appears, it seems the XMLHttpRequest object does not work in non-IE
browsers.
CLIENT (this page has an .HTML extenshion on the web server)
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<script language=javasc ript>
function submitForm()
{
var xhr;
try { xhr = new XMLHttpRequest( ); }
catch(e)
{
xhr = new ActiveXObject(M icrosoft.XMLHTT P);
}
xhr.onreadystat echange = function()
{
if(xhr.readySta te == 4)
{
if(xhr.status == 200)
{
var x1 = xhr.responseTex t;
alert(x1);
}
else
{
alert("failed") ;
}
}
};
xhr.open("POST" , "http://localhost:2160/WebSite1/SendIt.aspx",
true);
xhr.send("JAMES 1");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<button id="Button1" value="start2"
onclick="submit Form();">Test2</button>
</div>
</form>
</body>
</html>
SERVER (here is the Page_Load event from the ASPX page)
protected void Page_Load(objec t sender, EventArgs e)
{
string txt = "";
string input = null;
StreamReader sr = new StreamReader(Re quest.InputStre am);
while ((input = sr.ReadLine()) != null)
{
txt += input;
input = null;
}
sr.Close();
sr.Dispose();
//Request.SaveAs( @"c:\temp2\requ est.txt", true);
Response.Write( txt);
Response.End();
}
On Sep 10, 11:42 pm, bruce barker <nos...@nospam. comwrote:
i don't see an error in your code. try:
xhr.open("POST" , "SendIt.aspx",t rue);
in case the port is wrong. instead of try/catch you can also use:
var xhr = window.XMLHttpR equest ?
new XMLHttpRequest( )
: new ActiveXObject(M icrosoft.XMLHTT P);
-- bruce (sqlwork.com)
Thanks. I applied those suggestions and the same behavior continues.
To be more specific:
in Internet Explorer 6 & 7 everything IS working as expected.
In Mozilla FireFox 2.0 the onreadystatecha nged event is fired,
readyState is = 4, but if I try to examine the value of status an
exception is thrown, no content is returned from SendIt.aspx
In Apple Safari for Windows, onreadystatecha nged event never fires.
Another thing to note: if I uncomment out the line in the SendIt.aspx
that saves the Request body to a file I notice that in both Safari and
FireFox 2.0 the request never makes it through.
All advice is welcome.
I'm wondering if this has something to do with cross-domain
restrictions on HttpXMLRequest found in Safari and FireFox, but
aparently relaxed a bit in IE. Seems like those browsers would resolve
localhost to the same domain.
I've also tried modifying my host file to ref: www.mytestingground.com
127.0.0.1
Still the same problem there. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: tarun.sinha |
last post by:
Hello All
Please Help me out, I have heard about Ajax Programming.
I want to use it in my application but i can't understand
the basic of Ajax.I serach a lot and studied in google
Please excuse me for a poor Knowledge in Web Technology.
One more Thing I need to ask may it is ver silly question to ask.
I used validation control called RegularExpression,but when the error
Mesg display say "Invalid ID" it disturbed the aliginment of the
|
by: Richard Carpenter |
last post by:
Considering a typical scenario where the user is presented a list of
customers and, upon selecting one and clicking a button, they are then
presented with a new page depicting the orders for that customer and
the detail items for each order, what is the conventional (best) way to
"pass" the CustomerID from the first page to the second page and then
use it to only select the relevant orders to display as well as only
the relevant order...
|
by: Tami |
last post by:
Hello, I could use some advice on the best way to connect to some php in my source code using ajax. So that the php will re-execute after so much time with a script elsewhere on the server. Please let me know, thanks. Tami
|
by: walterbyrd |
last post by:
With PHP, libraries, apps, etc. to do basic CRUD are everywhere. Ajax
and non-Ajax solutions abound.
With Python, finding such library, or apps. seems to be much more
difficult to find.
I thought django might be a good way, but I can not seem to get an
answer on that board.
I would like to put together a CRUD grid with editable/deletable/
|
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= |
last post by:
I'm about to finally make the jump and start a new site using AJAX. THe
question i have for all of you AJAX developers out there is which one?
1. The Standard AJAX frame work
2. The Tool kit.
3. Or are there others out there.
4. Should i not do AJAX at all because it still posts back the entire page
even though
only the section is refreshed. (someone tell me i'm wrong here and why
please!)
| |
by: MikeB |
last post by:
Hello All, I am new to ajax and wanted to start by trying something simple.
I have a web form with an updatepanel and then inside the update panel I
have a listbox. Then outside of the updatepanel I have a button. In my
buttons click event in the cs / code behind, I have a loop that just inserts
items in the listbox. My question is, once I click the button and the loop
begins, how do I get it to update the listbox? Does this make since?...
|
by: JJ |
last post by:
New to AJAX:
If I have the ajaxToolkit:ToolkitScriptManager on a page, do I still need
to include the asp:scriptmanager if I am using an update panel for example?
If I started building a site from the 'AJAX Enalbed web site' template, then
added an item from the toolkit, does the ajaxToolkit:ToolkitScriptManager
get automatically added?
Sorry for the basics questions,
JJ
|
by: Jonathan Wood |
last post by:
Greetings,
I'd like to implement some AJAX features on an existing ASP.NET site. I have
one example of doing this but, otherwise, don't know much about it.
I have one question, though, about getting started: I notice that there are
project templates for creating AJAX this and AJAX that. I'm a little
confused about this. Am I not able to add AJAX features to an existing Web
form? Why is it necessary to select an AJAX form or whatever?
|
by: BobF |
last post by:
<given>
When starting a new AJAX Control enabled site, a set of files are created.
These are created -without- a master page.
</given>
To add a master page, I've been adding the master via add-new-item.
However, there is no automajic addition of references etc. to already
existing forms.
Now I have a few options:
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |