CodeIgniter Forums
js param... - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: js param... (/showthread.php?tid=44363)



js param... - El Forum - 08-12-2011

[eluser]Unknown[/eluser]
Hi everybody,

I have a problem with this code below.
My syntax is incorrect because the js/Java plugin I use, need the exportMethod('param1') terms with single quotes before and after the param1...

Is there a way to make it work?

Code:
// Submit button
    $js = 'onClick="exportMethod('param1')"';
    $data_submit = array(
    'type' => 'Submit',
    'content' => 'Search this now!',
     );
        
    echo form_submit($data_submit, $js);

:-S

Best regards.

Jim.


js param... - El Forum - 08-12-2011

[eluser]danmontgomery[/eluser]
http://php.net/manual/en/language.types.string.php

Quote:To specify a literal single quote, escape it with a backslash (\). To specify a literal backslash, double it (\\). All other instances of backslash will be treated as a literal backslash: this means that the other escape sequences you might be used to, such as \r or \n, will be output literally as specified rather than having any special meaning.

Code:
'onClick="exportMethod(\'param1\')"';



js param... - El Forum - 08-12-2011

[eluser]Unknown[/eluser]
Thank you this is working.