473,626 Members | 3,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Debugging javascript/Ajax

2 New Member
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.

Expand|Select|Wrap|Line Numbers
  1. myTable = '<table border=1><tr><th>Sel</th>';
  2. myTable = myTable + '<th\ onClick=\"mySort(\'pri\', 1 );\">pri</th>';
  3. myTable = myTable + '<th>Date</th><th>Rqstr</th><th>Status</th><th>Desc</th></tr>';
  4. myTable = myTable + statusRSP;
  5. myTable = myTable  + '</table>';
  6. document.getElementById("Layer2").innerHTML = myTable;
  7.  
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.
May 7 '07 #1
4 1351
acoder
16,027 Recognized Expert Moderator MVP
You don't need to escape the double quotes within single quotes.
May 8 '07 #2
moho
21 New Member
just a tip: you can do xxx += zzzzz, saves some space
May 8 '07 #3
Smudly
2 New Member
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.
May 8 '07 #4
acoder
16,027 Recognized Expert Moderator MVP
Glad you got it working.
May 8 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

25
4289
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...
1
962
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
8
3100
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...
2
3147
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); ...
6
1942
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...
3
2580
omerbutt
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>
8
3134
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...
3
1247
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,
0
8266
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, 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...
0
8505
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 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...
0
7196
agi2029
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...
1
6125
isladogs
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...
0
5574
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();...
0
4092
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...
0
4198
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2626
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
2
1511
bsmnconsultancy
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...

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.