mardi 15 mars 2016

ajax:beforeSend getting triggered on any ajax call

I am trying to bing ajax:beforeSend, ajax:error and ajax:complete to my rails form which gets submitted remotely.

$('form#contact_form').bind('ajax:beforeSend', function(evt, xhr, settings) {
  //getItemIds(); added this call on button click
  call();
})
.bind('ajax:error', function(event, request, settings) {
  text();
})
.bind('ajax:complete', function(event, request, settings) {
  phone();
});

I have other anchor links on the page which also fore ajax call. but for any ajax call made the beforesend function is getting called. i want to call it only for forms.

Can anyone tell what is that i am doing wrong, Thanks.

Aucun commentaire:

Enregistrer un commentaire