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="javascript" 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.XMLHTTP");
} catch (e){
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var ajaxDisplay = document.getElementById('image');
ajaxDisplay.innerHTML = ajaxRequest.responseText;
}
}
var text = document.getElementById('text').value;
var font = document.getElementById('font').value;
var size = document.getElementById('size').value;
var rl = document.getElementById('rl').value;
var ud = document.getElementById('ud').value;
var queryString = "?text=" + text + "&font=" + font + "&size=" + size + "&rl=" + rl + "&ud=" + ud;
ajaxRequest.open("GET", "mygenerator.php" + queryString, true);
ajaxRequest.send(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">Palatino</option>
<option value="Fonts/Chicago">Chicago</option>
<option value="Fonts/Skia">Skia</option>
<option value="Fonts/Sand">Sand</option>
<option value="Fonts/Courier">Courier</option>
<option value="Fonts/Jokerman LET Fonts">Jokerman</option>
<option value="Fonts/Techno">Techno</option>
<option value="Fonts/Charcoal">Charcoal</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>Position (left/right)</td><td><input id="rl" type="TEXT" name="rl" size="5"></td></tr>
<tr><td>Position (up/down)</td><td><input id="ud" type="TEXT" name="ud" size="5"></td></tr>
<tr>
<td>SUBMIT</td><td><input type="BUTTON" onclick="ajaxFunction()" value="check"></td></tr>
</form><br />
</table>
<div id="image">in here maybe</div>
</body>
</html>[/HTML]
7 1606
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
Hmm, how about moving the onreadystatechange to after the open(), i.e. open, then onreadystatechange, 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 encodeURIComponent().
Hope that helps.
Hmm, how about moving the onreadystatechange to after the open(), i.e. open, then onreadystatechange, 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 encodeURIComponent().
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!
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!!
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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:...
|
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!
...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |