<script type="text/javascript">
function voteUp()
{
var client = new XMLHttpRequest();
client.onreadystatechange = function() {
if(client.readyState==4)
{
alert("fish is fried");
}
if(client.readyState==3)
{
alert("3");
}
if(client.readyState==2)
{
alert("2");
}
if(client.readyState==1)
{
alert("1");
}
if(client.readyState==0)
{
alert("0");
}
}
client.open("POST", "10", true);
client.send(null);
alert(client.responseText);
}
function voteDown()
{
alert("Downvoted!");
}
</script>
So it works to send and receive. All messages pop up.
But I don't get the result from webpy.
ive tried both
if searchTerm.has_key("10"): and
if not searchTerm.has_key("10"):
but nothing seems to happen.
class main:
def GET(self):
latesteps = db.GqlQuery("SELECT * FROM Episode LIMIT 8")
mostpopular = db.GqlQuery("SELECT * FROM Episode LIMIT 8")
return render.frontpage(latesteps, mostpopular)
def POST(self):
searchTerm = web.input()
if searchTerm.has_key("10"):
#searchTerm['url'].votes += 1
return 44
else:
answers = db.GqlQuery("SELECT * FROM Episode WHERE title
= :1", \
searchTerm)
return render.results(searchTerm, answers)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---