473,503 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem passing Variable from Javascript Function Constructed inside PHP

5 New Member
The following code treats abcd as a variable and gives the error variable undefined in firebug
Expand|Select|Wrap|Line Numbers
  1. return $data = "<a href='#' onclick='ajaxcall(abcd);'>".$name."</a>";
The following code gives the error XML Parsing Error at 1:44. Error 73: > required
Expand|Select|Wrap|Line Numbers
  1. return $data = "<a href='#' onclick='ajaxcall('abcd');'>".$image.$tmp->name."</a>";
I also have tried typecasting, taking abcd inside another PHP variable then passing the PHP variable. None seem to work.

Thank you for your help.
Regards,
Sunny.
Jun 8 '10 #1
2 1533
JKing
1,206 Recognized Expert Top Contributor
Expand|Select|Wrap|Line Numbers
  1.  
  2. $data = <<<EOD 
  3. <a href="#" onclick="ajaxcall('abcd')">.$name.</a>
  4. EOD;
  5.  
Give this a try. Using the heredoc syntax, it lets you get around having to escape quotes.
Jun 9 '10 #2
sunnypirate
5 New Member
Thanks JKing!

It worked. Awesome.
Jun 10 '10 #3

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

Similar topics

9
2146
by: Max | last post by:
I'm new with Javascript and can't seem to figure out what I'm doing wrong here as I'm not able to pass a simple variable to a function. In the head of doc I have: <script...
1
2755
by: Jamie | last post by:
I am using remote scripting to call a .NET page within a main page. The child page (child.aspx) returns html that contains dynamically created javascript methods (function test()). The parent...
1
3436
by: novice_developer | last post by:
Hi All, there is a radiobuttonlist having 2 list items (state & zipcode). when i select state radiobutton the zipcode textbox should be disabled and when i select a zipcode radiobutton the state...
4
2543
by: thomasp | last post by:
In the code below I have a function that tests if a file exists. It takes a variable named strFileName, simple enough. My question is, is there a way to pass it a variable with another name as...
14
5761
by: Karl O. Pinc | last post by:
Hi, Thought perhaps some other eyes than mine can tell if I'm doing something wrong here or if there's a bug somewhere. I've never passed a ROWTYPE varaible to a function but I don't see where...
18
43515
by: Chris Ianson | last post by:
Hi geniuses (or is that genii, or genies) The challenge is as above really. I have a page with an iframe in it, and need to call a JS function in the *parent* page, *from* inside the iframe. ...
0
7093
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
7353
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...
1
7011
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
4689
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...
0
3180
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...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1521
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 ...
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
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...

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.