cancel
Showing results for 
Search instead for 
Did you mean: 

Issue while communicating to javascript

faisal_pc
Active Contributor
0 Kudos

Hi All,

I am facing a small issue while communicating to javascript from .htm page. My current code is as below.


<% DATA:lv_url TYPE CRMT_IC_LTX_URL_PART1.
SELECT SINGLE url
   FROM ZMYTABLE
   INTO lv_url
  WHERE SYSTEM_NAME = sy-sysid. %>

<script type="text/javascript">
var lv_url_js;
lv_url_js = <%= lv_url %>.
window.open(lv_url_js,"mywindow","menubar=1,resizable=1,width=350,height=250");
  </script>

The issue is when I assign the variable lv_url to lv_url_js. If I just give www.google.com in window.open, it is working. But the above code is not working. Could anybody help?.


Thanks,

Faisa;

Accepted Solutions (1)

Accepted Solutions (1)

jyguyomarch
Advisor
Advisor
0 Kudos

Hi Faisal,

Your JS code is pretty straightforward, But it might be an escaping issue. You can directly escape your URL on the BSP Layou by doing:

lv_url_js = '<%javascript= lv_url %>';

See the BSP Escaping Help Topic for more info.

Let me know if it works.

BR - JYves

PS: Line 09 in your example ends with a period and is missing some quotes (unless they are already part of lv_url).

Answers (2)

Answers (2)

Former Member
0 Kudos

the issue is the dot(.) and missing quotes, put it like this


lv_url_js = "<%= lv_url %>";

faisal_pc
Active Contributor
0 Kudos

Hi All,

Any javascript experts?...

Thanks,

Faisal