troubleshooting Question

ORACLE SQL, jQuery, and Single-Quotes - Fun?

Avatar of BILL Carlisle
BILL CarlisleFlag for United States of America asked on
1 Comment1 Solution96 ViewsLast Modified:
Condensed demo of the real situation but this shows my issue:
ORACLE SQL likes this statement:
SELECT '<tr><td><a href="javascript:apex.event.trigger(document, ''''editXtra''''}]);void(0);"></a></td></tr>'
from dual;
Output is:
<tr><td><a href="javascript:apex.event.trigger(document, ''editXtra''}]);void(0);"></a></td></tr>
I pass this to the client via dynamic Action (AJAX) but jQuery doesn't like the 2 single-quotes and gives a "Uncaught SyntaxError: missing ) after argument list" error.
$('[summary="SITE"] tr:last').after('<tr><td><a href="javascript:apex.event.trigger(document, ''editXtra''}]);void(0);"></a></td></tr>');
Uncaught SyntaxError: missing ) after argument list

jQuery does like a single-quote escaped \'
$('[summary="SITE"] tr:last').after('<tr><td><a href="javascript:apex.event.trigger(document, \'editXtra\'}]);void(0);"></a></td></tr>');

BUT the way I'm doing it in SQL it gives error:
SELECT '<tr><td><a href="javascript:apex.event.trigger(document, \'editXtra\'}]);void(0);"></a></td></tr>'
from dual;
ORA-00911: invalid character

I feel like I am missing the obvious.. any ideas?
BILL Carlisle
APEX Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros