Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript By pass the string parameter

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #157293
    gowda24
    Participant

    I am passing xmlstring datatype to jqgrid.

    var FrequencyCodelist = 
    "<?xml version='1.0' encoding='utf-8'?>"+
    "<invoices><rows>"+
    "<row><cell><![CDATA[<a onclick='AddFreq(2);' href='#'></a>]]></cell></row>"+
    "</rows></invoices>";
    

    I need to pass AddFreq('2X',4) as parameter.

    I tried by passing AddFreq('2X',4) inside the above xml but getting syntax error

    Please help in passing the AddFreq('2X',4) to the jqgrid.

    #157310
    __
    Participant

    I tried by passing AddFreq(‘2X’,4) inside the above xml but getting syntax error

    My guess would be that you’re not escaping your quotes.

    <a onclick='AddFreq( \'2X\',4 );' …
    

    Beyond that, I’m not even sure what xml allows/doesn’t as far a javascript goes. I know that, generally speaking, javascript syntax is not compatible with xml and should be served separately from an external script file.

    #157335
    gowda24
    Participant

    @traq

    I had tried previously escaping the quotes. But escaping the codes as you described is breaking the anchor tag as below

    <a href="#" 2x',4);'="" onclick="AddFreq(">3X</a>
    

    Which should pass as

    <a href="#"  onclick="AddFreq('2x',4);' >3X</a>
    
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.