14 messages in com.googlegroups.google-appengine[google-appengine] Re: Ajax
FromSent OnAttachments
crgwbr28 Apr 2008 15:05 
Matteo28 Apr 2008 16:13 
crgwbr28 Apr 2008 16:41 
crgwbr28 Apr 2008 16:48 
Matteo28 Apr 2008 16:54 
crgwbr28 Apr 2008 17:35 
Matteo28 Apr 2008 18:01 
manatlan29 Apr 2008 02:20 
Peter Svensson29 Apr 2008 03:06 
crgwbr29 Apr 2008 04:49 
Matteo29 Apr 2008 06:09 
palp30 Apr 2008 00:58 
Mike Garcia30 Apr 2008 09:00 
crgwbr30 Apr 2008 15:15 
Subject:[google-appengine] Re: Ajax
From:manatlan (mana@gmail.com)
Date:04/29/2008 02:20:02 AM
List:com.googlegroups.google-appengine

use jquery to make your ajax call ... it works like a charm on dev localhost, on appspot subdomain, and on real domain (google app)

On 29 avr, 03:02, Matteo <matt@gmail.com> wrote:

I've just done a little test by my own.

Meanwhile i was using 127.0.0.1:8080 i wasn't able to get XMLHTTPReq working, as soon as I started dev_appserver.py --port=80 it worked fine for me.

hope this helps.

On Apr 29, 2:35 am, crgwbr <crg@gmail.com> wrote:

The app isn't online yet, so the IP of dev_appserver.py is localhost (127.0.0.1).

On Apr 28, 7:55 pm, Matteo <matt@gmail.com> wrote:

wait, if you are using an online account of google app engine with an appspot.com domain you have to set something like

On Apr 29, 1:48 am, crgwbr <crg@gmail.com> wrote:

Update: changing the URL in that way didn't change any thing.

On Apr 28, 7:42 pm, crgwbr <crg@gmail.com> wrote:

k, so you are saying it should be:

var url = "http://localhost:8080/main/" + escape(tab);

I'll give this a try, but when I upload this to Google's servers, it seems like the link will break. So, I doubt this will work a a permanent solution. I'll post when I've given it a try.

Thanks, Craig

On Apr 28, 7:14 pm, Matteo <matt@gmail.com> wrote:

Mhh looking at this i had only a little doubt about this:

var url = "/main/" + escape(tab);

are you sure haven't you to add your dev_appserver ip too in that var?

On Apr 29, 12:05 am, crgwbr <crg@gmail.com> wrote:

I'm trying to write a page that interacts with the server via AJAX. The Javascript seems to work to a limited extent, but it receives no response from the server. Also, the dev_appserver.py window doen't show any interaction when the javascript shold be submitting and receiving things.

Javascript functions:

<script type="text/javascript">

function bodyUpdate(tab) {//v1.0 var request; try { request = new XMLHttpRequest(); } catch (trymicrosoft) { try { request = new ActiveXObject("Msxml2.XMLHTTP"); } catch (othermicrosoft) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (failed) { request = false; } } }

if (!request) alert("Error initializing XMLHttpRequest!");

var url = "/main/" + escape(tab); request.open("GET", url, true); request.onreadystatechange = updatePage(); request.send(null);

}

function updatePage() { var loading = '<p class="style1"><span class="style3"><strong>Loading...</strong></span></p>'; var finished = '<p class="style1"><span class="style3"><strong>Finished</strong></span></p>';

document.getElementById("body").innerHTML = loading; if (request.readyState == 4) { if (request.status == 200) { var response = request.responseText; document.getElementById("body").value = response; } else alert("status is " + request.status); }

}

</script>

Python:

class UpdateNextActions(webapp.RequestHandler): def get(self): tasks = database.Task.all() if users.get_current_user(): tasks.filter('creator =', users.get_current_user()) tasks.order('date') template_values = {'tasks':tasks} path = os.path.join(os.path.dirname(__file__), 'NextActionsTemp.htm') self.response.out.write(template.render(path, template_values)) else: self.redirect('/')

All help is appreciated.