I have my server request working but it will only make the request once. onclick calls the ajax function but only once. when i change entires in the form and hit the button nothing happens
Here is the code:
[HTML]<html>
<head>
<script language="javas cript" type="text/javascript">
<!--
//Browser Support Code
function ajaxFunction(){
var ajaxRequest; // The variable that makes Ajax possible!
try{
// Opera 8.0+, Firefox, Safari
ajaxRequest = new XMLHttpRequest( );
} catch (e){
// Internet Explorer Browsers
try{
ajaxRequest = new ActiveXObject(" Msxml2.XMLHTTP" );
} catch (e) {
try{
ajaxRequest = new ActiveXObject(" Microsoft.XMLHT TP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onr eadystatechange = function(){
if(ajaxRequest. readyState == 4){
var ajaxDisplay = document.getEle mentById('image ');
ajaxDisplay.inn erHTML = ajaxRequest.res ponseText;
}
}
var text = document.getEle mentById('text' ).value;
var font = document.getEle mentById('font' ).value;
var size = document.getEle mentById('size' ).value;
var rl = document.getEle mentById('rl'). value;
var ud = document.getEle mentById('ud'). value;
var queryString = "?text=" + text + "&font=" + font + "&size=" + size + "&rl=" + rl + "&ud=" + ud;
ajaxRequest.ope n("GET", "mygenerator.ph p" + queryString, true);
ajaxRequest.sen d(null);
}
//-->
</script>
<title>Enter dimensions.</title>
</head>
<body>
<table>
<form>
<tr>
<td>Your Text</td><td><input id="text" type="TEXT" name="text" ></td></tr>
<tr>
<td>Select a font</td><td><select id="font" name="font">
<option value="Fonts/Palatino">Palat ino</option>
<option value="Fonts/Chicago">Chicag o</option>
<option value="Fonts/Skia">Skia</option>
<option value="Fonts/Sand">Sand</option>
<option value="Fonts/Courier">Courie r</option>
<option value="Fonts/Jokerman LET Fonts">Jokerman </option>
<option value="Fonts/Techno">Techno</option>
<option value="Fonts/Charcoal">Charc oal</option>
</select></td></tr>
<tr><td>Size eg.20-100</td><td><input id="size" type="TEXT" name="size" size="5"></td></tr>
<tr><td>Positio n (left/right)</td><td><input id="rl" type="TEXT" name="rl" size="5"></td></tr>
<tr><td>Positio n (up/down)</td><td><input id="ud" type="TEXT" name="ud" size="5"></td></tr>
<tr>
<td>SUBMIT</td><td><input type="BUTTON" onclick="ajaxFu nction()" value="check"></td></tr>
</form><br />
</table>
<div id="image">in here maybe</div>
</body>
</html>[/HTML]
7 1621 acoder 16,027
Recognized Expert Moderator MVP
It's possible it may be cached. To avoid caching, add something like "&t="+(new Date()).getTime () to the URL.
It's possible it may be cached. To avoid caching, add something like "&t="+(new Date()).getTime () to the URL.
I tried that and no luck. Any other sugestions?
Thanks
acoder 16,027
Recognized Expert Moderator MVP
Hmm, how about moving the onreadystatecha nge to after the open(), i.e. open, then onreadystatecha nge, then send().
If you were to test with those same parameters without Ajax, does it give the correct response? You should encode the parameters using encodeURICompon ent().
Hope that helps.
Hmm, how about moving the onreadystatecha nge to after the open(), i.e. open, then onreadystatecha nge, then send().
If you were to test with those same parameters without Ajax, does it give the correct response? You should encode the parameters using encodeURICompon ent().
Hope that helps.
Thanks for trying again but none of that worked either.
I have tried with just the php pages. It worked.
I would be happy to put the php page here but as it processes it once I can't believe the problem is there. The image that is generated will always have the same name. Could that have an effect on the cache?
Just checked the cache.
It must be the problem as when i emptied it it worked and then stored it again.
using firefox and safari to test
baffled again!
acoder 16,027
Recognized Expert Moderator MVP
What is it that you return from the Ajax request? Is it an img tag?
Try adding the date/time to the src of the image.
What is it that you return from the Ajax request? Is it an img tag?
Try adding the date/time to the src of the image.
YOU GOT IT!!!
Thank you!!
My bruised head can heal now!!
acoder 16,027
Recognized Expert Moderator MVP
Lol - you're welcome. Post again if you have more questions ;)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Thue Tuxen Sørensen |
last post by:
Hi everybody !
I´m maintaining a large intranet (approx 10000 concurrent users) running on
one IIS box and one DB box with sqlserver 2000.
Currently there is 2,5 GB Ram, 1 1400 mhz cpu and 2 scsi disks installed on
the db box.
Sqlserver is set to use max 1,4 GB RAM, and the sqlserver does not seem to
be using it all.
|
by: Webster |
last post by:
Hello,
What's the best way to run a client-server interaction using some
standardized protocol such as nntp?? That is, should you run a thread that
just does a receive loop from the server so that if the server sends
anything, it will be received? Or what about if everytime you send data,
then you do a receive; so if you were *expecting*...
|
by: Nate |
last post by:
We are attempting to make a request to a web service (we will refer to it as
XXXServices) hosted on a Web Logic server from a C# SOAP client. The server
responds with a 401 Unauthorized error (that appears in plain text), and
causes the client to crash. This C# code has been deployed both as an
ASP.NET application and a WinForms app, each of...
|
by: UJ |
last post by:
Folks,
We provide custom content for our customers. Currently we put the files on
our server and people have a program we provide that will download the
files. These files are usually SWF, HTML or JPG files. The problem as I see
it - if you know the name of the file, you could download it off the server
(currently we are using an HTTP/Get but...
|
by: Jobs |
last post by:
Download the JAVA , .NET and SQL Server interview with answers
Download the JAVA , .NET and SQL Server interview sheet and rate
yourself. This will help you judge yourself are you really worth of
attending interviews. If you own a company best way to judge if the
candidate is worth of it.
http://www.questpond.com/InterviewRatingSheet.zip
| |
by: Lee T. Hawkins |
last post by:
I am having a number of problems over the last two full days trying to get
an ASP.NET 2.0 application to connect to a SQL Server 2005 database...
First off, I built this application w/ Visual Studio 2005 SP1 and had it
working perfectly on my Windows XP machine on SQL Server 2005 Express. I
decided to publish this application to a test...
|
by: Kevin Liebowicz |
last post by:
Yes, I wasted the past two days trying to fix this.
Yes, this is on a Win2003 Server.
Yes, this machine is a domain controller.
Yes, I seen the dozens of KB articles like this one:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q315158
But the problem is that 99% of these are for ASP .NET 1.x and this
is .NET 2.x which I just...
|
by: graphicssl |
last post by:
Okay, so first of all, I'm a designer first and a light coder second (I'm only really trained with HTML and CSS). So I apologize for having to post about something that's probably super-trivial!
I'm working on setting up a shopping cart for a one-product web site, and I'm using HTML and CSS, with ASP for the shopping cart. The ASP takes the...
|
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. ...
|
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...
|
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...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
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...
|
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.
| |