Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var ROUTE = new function () {
- var oGlobal = this;
- this.sSaveUrl = '';
- this.setSaveUrl = function (_sUrl) {
- this.sSaveUrl = _sUrl;
- }
- this.setEventSubmit = function () {
- $('[id^="route_update"]').each(function () {
- $(this).click(function () {
- var oData = $(this).closest('tr').find('input').serializeArray();
- var oRow = $(this).closest('tr');
- console.log(oData);
- oReq = $.post(oGlobal.sSaveUrl, oData, function (data) {
- if (data['valid'] != "true") {
- //console.log('error');
- //Fade in
- oRow.closest('#comment').html('Error').css('display', 'block').fadeIn(1000);
- //Fade out
- setTimeout(function () {
- $('#comment').html('').fadeOut(1000);
- }, 1500);
- //fade in
- $('#comment')
- } else {
- $('#route_update').click(function () {
- $('#comment').slideDown();
- setTimeout(function () {
- $('#comment').fadeOut();
- }, 1000);
- });
- return false;
- }, 'json');
- return false;
- });
- });
- }
- this.init = function () {
- this.setEventSubmit();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement