I am trying to write a simple Ajax application using SUSE 10.2, Apache, PHP and Javascript.
I want to click on a table header and do some processing to update the table. i have a function mySort which is called when you click on a table header. It sets some fields on the page and calls a second function which does the xmlHttp.open and the xmlHttp.onready statechange calles. everything works fine the first time I click on a header. The fields are updated, the table is updated, there are no error messages in the Firefox error console or the Firebug window. However If I click on a header a second time I get an error message that mySort is not a function.
I have tried everything I can think of to fix this problem. I even went back to an old copy and reapplied all of the changes one by one until it stopped working to make sure that is where the problem was. I have also tried returning the onclick property from the PHP script.
In the PHP script I look up the new information for the table and rerturn the formatted table minus the tables tags. I then add the Table tags and the header line in the Javascript. everything works fine and keeps working it I take out the onclick property.
Below is the Javascript I am having problems with. I have examined the HTML before and after running the mySort function and I can find no differences. -
myTable = '<table border=1><tr><th>Sel</th>';
-
myTable = myTable + '<th\ onClick=\"mySort(\'pri\', 1 );\">pri</th>';
-
myTable = myTable + '<th>Date</th><th>Rqstr</th><th>Status</th><th>Desc</th></tr>';
-
myTable = myTable + statusRSP;
-
myTable = myTable + '</table>';
-
document.getElementById("Layer2").innerHTML = myTable;
-
layer2 holds the table and nothing else.
Thanks for any suggestions. If there is a better way to return the table from the PHP script please let me know.
4 1351 acoder 16,027
Recognized Expert Moderator MVP
You don't need to escape the double quotes within single quotes.
just a tip: you can do xxx += zzzzz, saves some space
Thanks for the replies. I removed the extra backslashs and tried again with the same results. Then I had the bright idea to rename the function. Once I renamed the function it started working. I am not sure what it was conflicting with but atleast it is working now.
Thanks again.
acoder 16,027
Recognized Expert Moderator MVP Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jeff |
last post by:
Use the MS Script Editor included free with MS Office 2002 and above,
for debugging Internet Explorer (IE).
This subject is of great interest to many JS developers, as there is no
obvious, low cost way to do sophisticated debugging in
IE6 other than to use the debugger described below, which is horribly
documented otherwise. I feel debugging is an important aspect of
projecting the useability of the language and needs to be made more...
|
by: Tom Kelly - Tampa |
last post by:
For everyone who wants to watch Ajax in action using ASP.NET.
I have come across a method to debug ajax script into server-side code,
I am not sure if it will work with classic ASP, but it may work as
well, I am using the latest Script Debugger from MS.
No matter here are the instructions on how to debug Ajax and ASP.NET
http://codechasers.blogs.com/codechasers/2005/08/aspnet_20_javas.html
|
by: Samik R. |
last post by:
Hello,
I am using the innerHTML property of a div placeholder to update the contents, and the HTML is provided from a perl script on the server side. The perl script gets called through AJAX when I press a button in the first page. The returned HTML in the div has another button, which, when pressed, should call the same perl script again. Think of the program as some sort of wizard.
The problem is, this works perfectly as expected in FF...
|
by: shivendravikramsingh |
last post by:
hi friends, i m using a ajax function for retrieving some values from a database table,and display the values in required field,my prob is that the ajax function i m using is working f9 once,but if i change something in php file using in ajax function.it not refreshed,means its shows the previous result it not get updated.i can't understand whats the prob.this is the code i m using:
<?
include("config.inc.php");
//error_reporting(0); ...
|
by: John Doe |
last post by:
Here's my issue: I have an instant messenger type feature for my site, its
basically an ajax IM feature. I run with a mysql backend on the site, i have
a div on my main page that runs a javascript timer to load the php page via
ajax every 15 seconds which checks the "pinguser" table to see if the user
has any chat requests, then echoes them to a div on the page. what i REALLY
want to do is have the ajax page see if there is a ping for the...
| |
by: omerbutt |
last post by:
hi there i have downloaded a prototype tooltip from
http://www.nickstakenburg.com/projects/prototip/
the logic it uses is to call the script after creating the <div> for example i am using the ajax method
<html>
<body>
<div id='my_div'>
</div>
|
by: cyqotiq |
last post by:
First, let me state that this is not necessarily a Firefox problem, as I haven't fully tested in IE just yet.
Second, let me state that this is not the typical "getElementById not working Firefox" post.
Third, there are pieces of this code that I am not at liberty to display, change, discuss, or re-implement. As far as this question is concerned, this means that (1) I cannot use 3rd party libraries, which is why I've implemented my own...
|
by: Phrank |
last post by:
Hello
I am teaching myself AJAX, and have now gotten to the point where
syntax errors are removed. I am using Javascript and HTML for now, to
get a dropdown menu.
The failed script follows an example in Steven Holzner's Ajax Bible pp
379-400. It is located at http://hackingajax.alimentarus.net/sixth.shtml
I have tried ddd, greasemonkey, and a number of other debuggers,
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |