开发者

Insert Javascript variable into PHP return

开发者 https://www.devze.com 2023-01-31 10:58 出处:网络
I am sure this should be easy but I ahve been going crazy trying to get it to work: return \'<img border=\"0\" src=\"\'.$args[\'Image URL\'].\'?amount=\'.$args[\'invoiceAmount\'].\'&trans_id=\

I am sure this should be easy but I ahve been going crazy trying to get it to work:

return '<img border="0" src="'.$args['Image URL'].'?amount='.$args['invoiceAmount'].'&trans_id='.$args['invoiceNumber'].'&jrox_svalue_1=Sitename:javascript:doc开发者_开发百科ument.write (sitename);" width="1" height="1">';

Essentially I need to inject the javascript varialbe "sitename" into the querystring value (jrox_svalue_1)for the image.

jrox_svalue_1=Sitename:javascript:document.write (sitename);

Any help would be apprecaited.


This should do the trick:

<script>
document.write("<?php echo '<img border="0" src="' . $args['Image URL'] . '?amount=' . $args['invoiceAmount'] . '&trans_id=' . $args['invoiceNumber'] . '&jrox_svalue_1=' ?>" + sitename + '" width="1" height="1">');
</script>


Hope this would help

<img id="jroxImg" src="'.$args['Image URL'].'?amount='.$args['invoiceAmount'].'&trans_id='.$args['invoiceNumber']." width="1" height="1"> 


<script type="text/javascript">

 var jroxImgObj=document.getElementById('jroxImg');

 var jroxImgSrc=jroxImgObj.getAttribute('src');

 jroxImgSrc+="&jrox_svalue_1="+siteName;//document.location ??

 jroxImgObj.setAttribute('src',jroxImgSrc);

</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消