the issue is in your javascript; the browser will never render the template 
on this setup.

when you view /test via GET (or missing one or more required POST items), 
templates/jg.pt is rendered.
when you view /test via POST with both variables present, the response is a 
redirect (HTTPFound)

your javascript submits "form data" but it's not submitting the form for 
the browser.  the response from pyramid is lost in javascript.

your flow is this:

    * browser-tab GET /test 
    ** browser-tab's javascript POST /test 
    ** pyramid redirect to /home
    ** browser-tab's javascript ???

in this flow, the browser tab doesn't POST, the javascript engine in the 
tab does.

because the POST happens within javascript, you need to use javascript to 
decide what to do.

typically before hitting send, one would define a callback hook for the xhr 
object, something like explained  
here: https://www.w3schools.com/xml/xml_http.asp

  xhr.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
      // do something with this.responseText;
      console.log('got response');
    }
  };


-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To post to this group, send email to pylons-discuss@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/cbfe7308-6176-4ffa-ba2c-238b686495fd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to