Routing problems with Codeigniter and Backbone.js

后端 未结 2 1869
-上瘾入骨i
-上瘾入骨i 2021-02-06 14:18

Here are the frameworks I am using:

  • Codeigniter
  • Codeigniter REST API
  • Require.js
  • Backbone.js

Runn

2条回答
  •  后悔当初
    2021-02-06 14:56

    Another way to keep your browser from submitting the http request with the HREF link is to just override it with javascript and jquery. Could be useful if you don't want to always use hashtags as Loamhoof suggested.

    Example:

    $('#linkID').on('click', function(event) {
    
        event.preventDefault();
    
        backboneRouter.navigate($(event.currentTarget).attr('href'), { trigger:true });
    
    });
    

提交回复
热议问题