I am not sure what javascript library you are using based on the code
snippet, but you seem to be looking for a javascript object to be
returned that contains XML.  What you are returning is simply the text
'hello world' as a plain vanilla http response.  You need to return
the type of object that the javascript call is expecting, usually a
JSON object, XML document, or perhaps a snippet of html.  If you are
already comfortable with xml use it, but if not, I believe that JSON
is a bit easier to work with, but that is simply my personal
preference.

look at the django documentation or search this groups archives for
"serializers" for examples of how to write the view.

I would also recommend that you look at a the Yahoo User Interface or
jQuery to do the ajax-based stuff in the browser, as those libraries
make it very simple.

You also should also use firebug to look at the ajax responses in the
browser, I do not know how ajax development is practical without
something like it.

hth,
-richard


On 5/9/08, Monica Leko <[EMAIL PROTECTED]> wrote:
>
> Hi
>
> I am trying to use some simple AJAX call, and can't get right result.
> I am using this Javascript function:
>
> function filterMarkers(){
>        var request = GXmlHttp.create();
>        request.open('GET', '/lbs/' + "?q=placeholder, true);
>        request.onreadystatechange = function() {
>                if (request.readyState == 4) {
>                //      var xmlDoc = request.responseXML;
>                        alert("ok");
>                }
>        }
>        request.send(null);
>        return false;
> }
>
> GXmlHttp is just XmlHttpRequest.
>
> When I click submit on my form, alert box popup, and everything is ok,
> django view process normally, but after that I get response from
> server, instead of doing nothing, not refreshing, I get hello world
> response.  How can I catch response i order to have unmodified page
> from which I call for request?
>
> My view is something like this:
> def map(request):
>        q = request.GET.get("q", "")
>        if q:
>                return HttpResponse("Hello world")
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to