javascript - parseJSON not catching form POST to python -
i have javascript html page has action post python file. python code supposed send json html. not know how catch json , parse it. think can parse fine if catch it, , life of me can't work. below html code excerpt python code excerpt. json supposed simple 1 value in it!
html code excerpts:
<form action="http://www.myurlhiddenhere.com/cgi-bin/new.py" id="form" method="post" enctype="multipart/form-data" target="resiframe"> <div style=" width: 0px; height: 0px; overflow: hidden;" > <input type="hidden" name="random" id="random" value=""> <iframe src="" name="resiframe" id="resiframe" onload="iframeloaded();" ></iframe> </div>
and here's try catch it:
function iframeloaded() { var result = $.parsejson($("#resiframe").contents().find("html").html()) ..... }
i wonder if doing wrong "target" stuff above? if print $("#restiframe") [object object]. not sure if catching json response in html.
and here's py code excerpt:
#!/usr/bin/python -tt # -*- coding: utf-8 -*- import cgi, os import cgitb; cgitb.enable() form = cgi.fieldstorage() data = {'score': 50} print "content-type: text/html" #print "content-type: application/json" print print json.dumps(data)
i've spent hours on , read numerous examples/blogs appreciated!
$("#resiframe").contents().text() worked initialxy suggested , lot initialxy debugging overall!
Comments
Post a Comment