Lost Password?

Go Back   CodeCall Programming Forum > Web Development Forum > AJAX

AJAX Web based language that allows asynchronous loading of pages that does not interfere with normal page loading.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-14-2007, 11:33 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,135
Rep Power: 15
Lop is on a distinguished road
Default AJAX - Escaping (

I have JavaScript and PHP working together fairly well except for this one error.

Code:
<script>
if value == 1
  document.write('$phpVariable');
</script>
Only the phpVariable has () in it so I get an error in my javascript - expecting ")". How do I escape the () in JavaScript?
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-14-2007, 04:01 PM
hoser2001's Avatar   
hoser2001 hoser2001 is offline
Programmer
 
Join Date: Jul 2006
Posts: 175
Rep Power: 9
hoser2001 is on a distinguished road
Default

This is just a guess...

Code:
<script>
if value == 1
  document.write('$phpVariable\(\)');
</script>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-17-2007, 10:56 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,135
Rep Power: 15
Lop is on a distinguished road
Default

I don't understand this. What is the \(\) doing?
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-17-2007, 02:13 PM
hoser2001's Avatar   
hoser2001 hoser2001 is offline
Programmer
 
Join Date: Jul 2006
Posts: 175
Rep Power: 9
hoser2001 is on a distinguished road
Default

if you are attempting to write a string, and your string contains (
then to escape that character would simply be \(

if your variable is a string, then you need to change that variable so that those characters are escaped in this way. Perhaps before sending the variable to the write function you can someone search for those characters and precede them with the escape character \
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-18-2007, 08:01 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,135
Rep Power: 15
Lop is on a distinguished road
Default

Ahh, I never thought about doing that. I suppose when I started combining the two I felt limited in what I could do. Thanks!
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Considering Ajax, Part 1: Cut through the hype Ronin JavaScript and CSS 0 12-13-2006 02:36 PM
Myth-Busting AJAX (In)security Jordan AJAX 1 12-03-2006 01:21 PM
AJAX Evolved Jordan JavaScript and CSS 0 09-09-2006 01:12 PM
More AJAX Resources NeedHelp JavaScript and CSS 2 07-13-2006 12:57 PM
Anybody use Ajax? Dan JavaScript and CSS 9 07-05-2006 03:25 PM


All times are GMT -5. The time now is 05:45 PM.

Contest Stats

John ........ 87.50000
dargueta ........ 75.00000
Xav ........ 50.00000
MeTh0Dz ........ 20.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000

Contest Rules

Ads