0

I've been searching to try to understand this, but I got a mixed and unclear understanding. The thing is when I make a get request to app.get:

app.get('/youarein', function(req, res) {
  console.log('getting in request');
  res.render('youarein.jade');
});

If I do it from an ajax call such as:

in: function(){
      console.log("in!");
      $.get('/youarein');
      return false;
    },

youarein.jade is not rendered and keep the previous .jade template (index)- I got the console log and the response from the server though

however if I do it from a form submit such as:

<form action="/youarein", method="get">
  <fieldset>
    <input type="submit" value="Submit" />
  </fieldset>
</form>

youarein.jade template is rendered and take the place of the previous one.

Is there a way in doing from Ajax? How does the Backbone pushState plays with this? Does it have to do anything with the HTML5 History Api?

Any comments to shine light on this will be highly appreciated.Thanks.

4

1 回答 1

0

只使用一个<a href="/youarein">标签,$.get不做你认为它做的事(它是用于 AJAX)

于 2013-06-08T13:09:37.273 回答