473,406 Members | 2,371 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.

Eval multiple lines of ajax response

Hey all
Ive ran into a bit of a problem when trying to parse multiple lines of javascript whitch are returned from an ajax request.

On the main page where the request orginates, i have a [HTML]<div id="top_left" />[/HTML]

I peform my ajax requests by using prototype as such:
Expand|Select|Wrap|Line Numbers
  1. function sendData(url, pars) {
  2. var myAjax = new Ajax.Request ( url, {method: 'get', parameters: pars, onLoading: showLoading, evalJS: true} );
  3. }
Ive set up a test, where the php script that generates the response returns:
Expand|Select|Wrap|Line Numbers
  1. $('top_left').innerHTML = 'test';
  2. alert("test");
  3.  
And this seems to work fine (text is shown, and alert alerts)

However when i try and send back the following nothing at all happens:
Expand|Select|Wrap|Line Numbers
  1. $('top_left').innerHTML= '<h1>Heading</h1><span title="title text">Welcome</span><ul><li id="search">Search here</li><li id="view">View here</li>';
  2. new Draggable("search", {ghosting:true, revert:true});
  3. new Draggable("view", {ghosting;true, revert: true} );
  4.  
Im compleatly baffled, ive tried escaping every quote, writing it as a lot of innerHTML writes, by appendingChild, returning the javascript to iterate though an array of the text i want displayed and write it to top_left, but Nothing seems to work.

Im unsure if theres something crucial i'm missing, or something.

If anyone could point me in the right direction that would be awsome, as im stuck (for once google hasent solved it)

Also, does anyone have a good firefox extension or know of a tool for validating ajax javascript returns?

Thanks in advance
Feb 4 '08 #1
3 2617
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

There's a semi-colon between ghosting and true in the third line.

A good tool is Firebug if you haven't already got it.
Feb 5 '08 #2
Yup got firebug, it just offers no support for whats returned by ajax requests.

And cheers, compleatly missed the semi-colon, working perfectly now
Thanks a lot for the help
Feb 6 '08 #3
acoder
16,027 Expert Mod 8TB
Firebug does give the Ajax request response. Click on the linked requests that appear in the console.

Glad to hear that you got this problem fixed.
Feb 6 '08 #4

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

Similar topics

3
by: Arun | last post by:
Hi, I have simple question to ask. How to write multiple Binary files to the Browser using Asp.Net and Visual C#.net I have seen examples where single binary file is written to browser. ...
17
by: petermichaux | last post by:
Hi, Is it possible for an AJAX request to be left open for multiple responses? This could avoid repetitive polling of the server. Thanks, Peter
12
by: Logos | last post by:
Yes, eval is a tool of the devil and I'll burn for using it. However, in this instance it's quite handy and I'm quite lazy. So, here's a weird one, and I'm wondering if anyone has a workaround....
1
by: trpost | last post by:
How can I accomplish the following using AJAX / PHP: I have a form with a text field and a search button next to the text field. When I type something in the text field and hit the search button...
1
by: MORALBAROMETER | last post by:
Hi all, I want to update MULTIPLE elements of an HTML page using Ajax. for this reason i my response is an xml document. I want to use XSL at the client side to update these elements. How can i...
17
by: Arjen | last post by:
Hi, I want to reload 2 divs at one click. Ive tried: <a href = "javascript:void(0);"...
5
by: wendallsan | last post by:
Hi all, I'm running into a situation where it seems that JS stops executing as soon as I call an eval in my script. I have an Ajax.Request call to a PHP page that builds a JS object and returns...
1
by: bizt | last post by:
Hi, I am having my first real attempt at an ajax class as so far Ive managed to build one that, once instatiated, will allow me to define which function it will call on completion then retrieves...
1
by: bizt | last post by:
Hi, Im currently looking to move into using JSON for AJAX instead of returning from the server a string like the following: 12345{This is a text string{true I prefer objects because I dont...
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?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...
0
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...

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.