Hi,
 I want to know how can we return reponseText to Javascript from
Python file. I tried  to send the data to python file by using GET
method, it is working fine but the thing is how to return the
resposeText (Result) to Javascript.
Here i mentioned my code below,


Test.html:
----------------------------------------------------------------------------------------------------------------------------------------
<form name="name1" method="GET">
        Name: <input type="text" id="myname" name="name1" onblur="showHint
()" />
        <span id="txtHint"></span>
</form>
----------------------------------------------------------------------------------------------------------------------------------------

Js File:
---------------------------

var xmlhttp;
function showHint()
{
var str=document.getElementById("myname").value;
if (str!=''){
        xmlhttp=GetXmlHttpObject();
        var url="http://localhost:5656/psltrac_internal/admin/general/
basics/";
        url=url+"?q="+str;
        xmlhttp.open("GET",url,true);
        xmlhttp.onreadystatechange=stateChanged;
        xmlhttp.send(null);
 }
}

function stateChanged()
{
 alert(xmlhttp.readyState)
if (xmlhttp.readyState==4)
  {
  alert(xmlhttp.responseText);
  }
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}
----------------------------------------------------------------------------------------------------------------------------------------

Python Files
-----------------------
if req.method == 'GET':
            if str(req.args.get("q"))!='' and str(req.args.get("q"))!
='None':
                 print "hello"

Here in python file i tried to send the responseText as
print
return
and req.send_header() all the methods failed to return responseText.

--

You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.


Reply via email to