Expand all | Collapse all

URL Encoding Javascript

  • 1.  URL Encoding Javascript

    Posted 14 days ago


    I am trying to Encode a Text Field within a javascript function. 
    The way I have it, it breaks the URL after any special character so its messing up my query.
    If anyone has any experience with this please feel free to comment and assist. 

    Thank You. 

    var span_val = $("span#FIELD_TO_ENCODE").html();
    var url = "";         
           url += "https://rxnb.quickbase.com/db/bqk9ep9fj";             
           url += "?act=API_AddRecord";             
           url += "&apptoken="+qbAppToken;             
           url += "&_fid_7=URLEncode("+span_val;                       
           url += "&_fid_6="+ order_ID;  

    Adis Kljajic

  • 2.  RE: URL Encoding Javascript

    Posted 14 days ago
    One issue that jumps out is in the line you have in bold.  You are missing the closing quotation mark and parenthesis.

    Paul Peterson

  • 3.  RE: URL Encoding Javascript

    Posted 13 days ago
    The syntax error is an issue, but I believe you're looking for encodeURI if this is javascript.  It's documented here:

    Neil Schneider