jquery - Javascript Custom event trigger issue -


I have a description view that has 2 buttons which will be /

on the click of these buttons , I display a modal popup

  var modal = new MyAppModalView ({Model: person}); Modal.bind ("afteraveave", function (value) {self.showMessage ('submitted successfully to save', wrong, true); return true;});  

In addition to the Model View Code, I have;

isnew} {// flow to this.model.save (myJSON, {url: "Myapp / people / create", success: work () {self.trigger ("after Save "); self.removeModal ();}}); } Other {// edit this.model.save (myJSON, {url: "myapp / persons / edit", success: function () {self.trigger ("afteraveave"); self.removeModal ();}} ); }

Now after saving for both create / edit, I trigger an event for later

While the event was triggered for making the flow , It has not been triggered Edit the flow I'm not sure why this happens?

I tried to force 2 separate even for the model (after saving / after updates) and triggered each to create / edit ... still to edit the trigger (

Please help me.


The code is called as below the saving action;

  var MyAppModalView = BaseModal.extend ({.... save action: function (event) {var self = this;}});  

< Div class = "post-text" itemprop = "text">

You will need to create POST (create) and PUT A should not be a separate URL (save). It will trim your code below:

  this.model.save (myJSON, {success: work} {self.trigger ( "Afteraveave"); self.removeModal ();}});  

If the model to be removed is called "save after" is being started, but your edit You can change your success message with a warning so that the matter may be verified after the scene.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -