Skip to main content
Question

URL Encoding Javascript

  • June 29, 2020
  • 0 replies
  • 113 views

Hello,

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
------------------------------
This topic has been closed for replies.

  • Quickbase Alumni
  • June 30, 2020
One issue that jumps out is in the line you have in bold.  You are missing the closing quotation mark and parenthesis.

------------------------------
Paul Peterson
------------------------------

  • Quickbase Alumni
  • June 30, 2020
Adis,
The syntax error is an issue, but I believe you're looking for encodeURI if this is javascript.  It's documented here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI

------------------------------
Neil Schneider
------------------------------