xhEditor上传回调json字串怎么处理?调用?
针对xhEditor上传程序开发规范,http://xheditor.com/manual/2#chapter4
以及在xhEditor程序demo中的uptest.html独立上传页面,上传文件后回传如下参数:
- JScript code
{'err':'','msg':{'url':'!upload\/day_110131\/20110131164055468.jpg','localname':'Thunder.jpg','id':'1'}}现谁能利用此回传函数用JQuery或JS写个将上传成功后的文件路径传至某表单文本框。帮忙写个,因为我实在不懂。
- HTML code
<form method="post" name="form1" action="upload.asp?immediate=1" enctype="multipart/form-data"> <input type="file" size="13" name="filedata" /> <input type="submit" size="13" name="submit" value="提交上传" /> </form>
[解决办法]
- JScript code
var resText = "{'err':'','msg':{'url':'!upload\/day_110131\/20110131164055468.jpg','localname':'Thunder.jpg','id':'1'}";var jsonObj = eval("("+resText+")");document.getElementById('你的表单ID').value=jsonObj.msg.url;