473,406 Members | 2,705 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,406 software developers and data experts.

Server communication without page reload?

I'm trying to find a way to have a script communicate with a server
without having to load a new page. The idea is to have the server act
as a simple wrapper for a database, letting the client do that icky UI
stuff.

I tried the obvious, putting a frame somewhere it doesn't insult the
eye, changing its location, then accessing the new content via DOM.
What I get from IE (6) for my pains is just a rude "permission
denied". This even though I entered "localhost" as a trusted site in
IE's security setting. What's amiss?

Help from one of you pros out there would be greatly appreciated! ;-)

TIA,
Kurita

ci***********@gmx.net
Jul 23 '05 #1
3 3979
On 14 Jun 2004 07:27:31 -0700, ci***********@gmx.net (Kurita
Kinoshita) wrote:
I'm trying to find a way to have a script communicate with a server
without having to load a new page. The idea is to have the server act
as a simple wrapper for a database, letting the client do that icky UI
stuff.

I tried the obvious, putting a frame somewhere it doesn't insult the
eye, changing its location, then accessing the new content via DOM.
What I get from IE (6) for my pains is just a rude "permission
denied". This even though I entered "localhost" as a trusted site in
IE's security setting. What's amiss?

Help from one of you pros out there would be greatly appreciated! ;-)


Not a pro, but if you don't want the page to reload, then you can
use the status: 204 http code to tell the brouser to not expect
to reload the page. I use it on my pages below to run programs on
my server with out having a page refresh, in this case to operate
pan and tilt webcams.

http://www.geocities.com/zoomkat/ppswitcher-demo.htm
http://www.geocities.com/zoomkat/ezservo1.htm

Jul 23 '05 #2
> I tried the obvious, putting a frame somewhere it doesn't insult the
eye, changing its location, then accessing the new content via DOM.
What I get from IE (6) for my pains is just a rude "permission
denied". This even though I entered "localhost" as a trusted site in
IE's security setting. What's amiss?


Thats weird,it should be accessable. Did you initialize the FRAME
before modifying its contents? I found that you normally first need
to load an SRC="about:blank" before you can access its properties
(like window.location). The corret path to the window object of
a frame would be document.frames[0].contentWindow. You can also use
XML to communicate. Maybe that would even be better.

Good luck,
Vincent

Jul 23 '05 #3
Kurita Kinoshita wrote:
I'm trying to find a way to have a script communicate with a server
without having to load a new page. The idea is to have the server act
as a simple wrapper for a database, letting the client do that icky UI
stuff.

I tried the obvious, putting a frame somewhere it doesn't insult the
eye, changing its location, then accessing the new content via DOM.
What I get from IE (6) for my pains is just a rude "permission
denied". This even though I entered "localhost" as a trusted site in
IE's security setting. What's amiss?

Help from one of you pros out there would be greatly appreciated! ;-)

TIA,
Kurita

ci***********@gmx.net


There are several options that can be used. The choice depends on the
amount and type of data that is being sent back and forth.
1. Loading file via XMLHTTP. The following function will return any type
of text data that you parse with client side script. The filename you
pass is the name of your server side script and can contain query string
that allows you to pass limited amount of data to the server:

function getFile(filename)
{ oxmlhttp = null;
try
{ oxmlhttp = new XMLHttpRequest();
oxmlhttp.overrideMimeType("text/xml");
}
catch(e)
{ try
{ oxmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{ return null;
}
}
if(!oxmlhttp) return null;
try
{ oxmlhttp.open("GET",filename,false);
oxmlhttp.send(null);
}
catch(e)
{ return null;
}
return oxmlhttp.responseText;
}

2. Similar to the method above you can dynamically create a script node:

function loadJS(filename)
{ scriptNode = document.createElement('script');
scriptNode.src = filename;
scriptNode.type = 'text/javascript';
(document.getElementsByTagName('head'))[0].appendChild(scriptNode);
}

Again filename is your server side script and can contain query string
as well. The difference is that the server side script has to return
javascript (make sure you set the MIME type header to
"text/javascript"). Compared to the first method you receive data ready
to be used.

3. If you have siginificant amount of data to pass to the server, you
would need a hidden iframe so that you can use POST method.

--
Vladdy
http://www.klproductions.com
Jul 23 '05 #4

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

Similar topics

8
by: Michele | last post by:
Hi all, I have developed a PHP-based website where a "planner" user can make up schedules of activities to be performed, storing them into MySQL tables. Afterwards, other "watcher" users can...
2
by: Steve | last post by:
I'm working in PHP, but am also using JavaScript, so perhaps there is a better way to do this using more PHP code...... I setup a search screen for my database, the user enters data and submits...
5
by: Bryan Field-Elliot | last post by:
We're designing a web app in which some operations will take a long time to complete (maybe two minutes). Because it's a high-volume application, we don't want browser connections hanging open for...
4
by: Mel | last post by:
i would like to have a link, such that when the user clicks on it, a script is fired to go to server and check for page updates, if any, it should request a reload, else stay silend (terminate) ...
1
by: Praveen | last post by:
Hi, I have installed WebSphere Portal on AIX and connected to DB2 on a remote machine, Getting the followin errors when trying to get the values from database thru applications installed on...
5
by: Leo Duran | last post by:
I am working on a web app and would like to enable it to use multiple browser windows... For example, a list of customers would have an Edit button. Edit | First Name | Last Name | Address...
1
by: Alin Capitanescu | last post by:
Hi all! I need some help with asp.net! Is there any way to make the client BROWSER (IE, NETSCAPE, OPERA etc) to wait for messages from a http/https host (server) in an internet environment? ...
5
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I force a reload from the server/prevent caching?...
2
by: Max | last post by:
Is it possible to reload a web page on user browser when an event occurs at server side? For example when user A places an order, user B should be notified of that and should see that order on his...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.