loadJSONDoc

View: New views
2 Messages — Rating Filter:   Alert me  

loadJSONDoc

by Tamas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi,

I am learning MochiKit and the js execution stops at "loadJSONDoc".
Callback functions are not added to the referrer and the string
returned from the server is written to the browser window as a new
text page (not included in html of the existing page).

function MyClick(eventObj) // called if clicked on the submit button
{
    alert( "start - click");
    d = MochiKit.Async.loadJSONDoc(
        "https://myhost/",
        { 'user': getElement('user').value,
          'pwd': getElement('pwd').value }  );

    alert( "click2"); // THIS NEVER COMVES UP
    d.addCallback(handleLogin);
    d.addErrback(handleLoginError);

******************************
Server side; cherrypy
user = kwargs['user']
pwd  = kwargs['pwd']
# checking user/pwd in the future; do nothing now
return simplejson.dumps([ data1, data2, data3])

# I also tried:
# return "{" + simplejson.dumps([200, "", str(session['ID'])]) + "}"

Thanks for your help in advance,
tamas

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to mochikit@...
To unsubscribe from this group, send email to mochikit-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: loadJSONDoc

by amit-29 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Don't use `alterts` to trace the execution of JS code particularly
with Ajax code. Use `MochiKit.Logging.log` instead...

On Jul 17, 6:50 pm, Tamas <biohege...@...> wrote:

> Hi,
>
> I am learning MochiKit and the js execution stops at "loadJSONDoc".
> Callback functions are not added to the referrer and the string
> returned from the server is written to the browser window as a new
> text page (not included in html of the existing page).
>
> function MyClick(eventObj) // called if clicked on the submit button
> {
>     alert( "start - click");
>     d = MochiKit.Async.loadJSONDoc(
>         "https://myhost/",
>         { 'user': getElement('user').value,
>           'pwd': getElement('pwd').value }  );
>
>     alert( "click2"); // THIS NEVER COMVES UP
>     d.addCallback(handleLogin);
>     d.addErrback(handleLoginError);
>
> ******************************
> Server side; cherrypy
> user = kwargs['user']
> pwd  = kwargs['pwd']
> # checking user/pwd in the future; do nothing now
> return simplejson.dumps([ data1, data2, data3])
>
> # I also tried:
> # return "{" + simplejson.dumps([200, "", str(session['ID'])]) + "}"
>
> Thanks for your help in advance,
> tamas
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "MochiKit" group.
To post to this group, send email to mochikit@...
To unsubscribe from this group, send email to mochikit+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---