How to use doSave method in root

Best JavaScript code snippet using root

account_center.js

Source:account_center.js Github

copy

Full Screen

1$(function () {2 var _province = ['110000', '120000', '310000', '500000'];3 console.log(1);4 $("#province ,#city").on("change", function () {5 var id = $(this).find("option:selected").attr("data-value");6 var region = '<option value="">请选择</option>';7 if (id != null && id != '') {8 region = getRegion(id);9 if ($(this).hasClass('province')) {10 $("#city").html(region);11 if ($.inArray(id, _province) > -1) {12 if ($("#district").hasClass('text')) {13 $("#district").removeClass('text');14 $("#district").addClass('hide');15 }16 } else {17 if (!$("#district").hasClass('text')) {18 $("#district").addClass('text');19 $("#district").removeClass('hide');20 }21 }22 } else if ($(this).hasClass('city')) {23 $("#district").html(region);24 }25 } else {26 if ($(this).hasClass('province')) {27 $("#city").html(region);28 }29 $("#district").html(region);30 }31 });32 $(".save_user_info").click(function () {33 if (_dosave == 1) {34 _dosave = 0;35 var _string = {};36 var os = 1;37 $(".list .text").each(function () {38 var _name = $(this).attr("name");39 var _value = $.trim($(this).val());40 if (_value == null || _value == '') {41 alert("请输入完整信息。" + $(this).attr('name'));42 os = 0;43 return false;44 }45 _string[_name] = _value;46 });47 $(".list .radio").each(function () {48 var _name = $(this).attr("name");49 var _value = $.trim($(this).val());50 if ($(this).is(':checked')) {51 console.log(_value);52 _string[_name] = _value;53 }54 });55 console.log(os);56 if (os == 1) {57 $.ajax({58 url: "./account-save_user_info.htm",59 type: "POST",60 data: _string,61 dataType: "json",62 success: function (data) {63 alert("记录成功");64 },65 complete: function (res) {66 _dosave = 1;67 }68 });69 }70 }71 _dosave = 1;72 });73 $(".photo_form").on("change", function () {74 if (_dosave == 0) {75 alert("文件正在上传中,请稍候");76 return false;77 }78 $('.check_photo').val(1);79 $.ajax({80 url: "./account-upload_photo.htm",81 type: "POST",82 cache: false,83 data: new FormData($('#uploadPhoto')[0]),84 processData: false,85 contentType: false,86 dataType: "json",87 beforeSend: function () {88 _dosave = 0;89 },90 success: function (data) {91 $(".photo_value").attr('src', data.data);92 },93 complete: function (res) {94 _dosave = 1;95 }96 });97 });98 $(".save_photo").click(function () {99 if ($('.check_photo').val() == 0) {100 return false;101 }102 if (_dosave == 1) {103 _dosave = 0;104 var _string = {};105 _string["photo"] = $(".photo_value").attr("src");106 $.ajax({107 url: "./account-save_photo.htm",108 type: "POST",109 data: _string,110 dataType: "json",111 success: function (data) {112 alert("记录成功");113 },114 complete: function (res) {115 _dosave = 1;116 }117 });118 }119 _dosave = 1;120 });121 $("#brithday").on('click', function () {122 $("#schedule-box").show();123 });124});125var getRegion = function (id) {126 var res = '<option value="">请选择</option>';127 $.ajax({128 async: false,129 url: "./ApiEnum-getRegion-id-" + id + ".htm",130 type: "GET",131 data: {},132 dataType: "json",133 success: function (obj) {134 var _data = obj.data.data;135 for (var i = 0; i < _data.length; i++) {136 res += '<option value="' + _data[i]['id'] + '" data-value="' + _data[i]['id'] + '">' + _data[i]['name'] + '</option>';137 }138 }139 }).done(function (msg) {140 //console.log(msg);141 });142 return res;143};144var _dosave = 1;145var mySchedule = new Schedule({146 el: '#schedule-box',147 //date: '2018-9-20',148 clickCb: function (y, m, d) {149 document.querySelector('#brithday').value = '' + y + '/' + m + '/' + d;150 $("#schedule-box").hide();151 },152 nextMonthCb: function (y, m, d) {153 document.querySelector('#brithday').value = '' + y + '/' + m + '/' + d;154 },155 nextYeayCb: function (y, m, d) {156 document.querySelector('#brithday').value = '' + y + '/' + m + '/' + d;157 },158 prevMonthCb: function (y, m, d) {159 document.querySelector('#brithday').value = '' + y + '/' + m + '/' + d;160 },161 prevYearCb: function (y, m, d) {162 document.querySelector('#brithday').value = '' + y + '/' + m + '/' + d;163 } ...

Full Screen

Full Screen

20150528-ProjectLinks.js

Source:20150528-ProjectLinks.js Github

copy

Full Screen

1var _ = require('underscore');2module.exports = function(dbAccess, callback) {3 var db = dbAccess.db;4 db.view('ProjectLinks', 'AllLinks', function(err, allDocs) {5 if (err) {6 return callback(err);7 }8 var toInsert = [];9 var found = _.find(allDocs.rows, function(doc) {10 var node;11 var d;12 var doSave = false;13 if (doc.value) {14 d = doc.value;15 // console.log('\nDEBUG ' + d._id + ' Original');16 // console.log(d);17 if (d.resource) {18 delete d.resource;19 doSave = true;20 }21 if (d.about) {22 delete d.about;23 doSave = true;24 }25 node = d.homePage;26 if (node) {27 if (node.resource) {28 d.homePage = node.resource;29 doSave = true;30 }31 }32 node = d.currentPlans;33 if (node) {34 if (node.resource) {35 d.currentPlans = node.resource;36 doSave = true;37 }38 }39 node = d.details;40 if (node) {41 if (node.resource) {42 d.details = node.resource;43 doSave = true;44 }45 }46 node = d.dashboard;47 if (node) {48 if (node.resource) {49 d.dashboard = node.resource;50 doSave = true;51 }52 }53 node = d.project;54 if (node) {55 if (node.resource) {56 d.project = cleanupResource(node.resource);57 doSave = true;58 }59 }60 // console.log('DEBUG ' + d._id + ' Updated');61 // console.log(d);62 if (doSave) {63 console.log('Document ' + d._id + ' pushed for Update.');64 toInsert.push(d);65 }66 } else {67 return true;68 }69 });70 if (!found) {71 db.bulk({72 docs : toInsert73 }, function(err, results) {74 return callback(err);75 });76 }77 });78};79var cleanupResource = function(res) {80 var i = res.lastIndexOf('/');81 if (i > 0) {82 res = res.substr(i + 1);83 }84 return (res);...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1$scope.doSave = function () {2 $rootScope.doSave();3}4$scope.doSave = function () {5 $rootScope.doSave();6}7$scope.doSave = function () {8 $rootScope.doSave();9}10$scope.doSave = function () {11 $rootScope.doSave();12}13$scope.doSave = function () {14 $rootScope.doSave();15}16$scope.doSave = function () {17 $rootScope.doSave();18}19for (var i = 0; i < 10; i++) {20 $scope['doSave' + i] = function () {21 $rootScope.doSave();22 };23}

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = this.getRoot();2root.doSave();3var root = this.getRoot();4root.doSave();5var root = this.getRoot();6root.doSave();7var root = this.getRoot();8root.doSave();9var root = this.getRoot();10root.doSave();11var root = this.getRoot();12root.doSave();13var root = this.getRoot();14root.doSave();15var root = this.getRoot();16root.doSave();17var root = this.getRoot();18root.doSave();19var root = this.getRoot();20root.doSave();21var root = this.getRoot();22root.doSave();

Full Screen

Using AI Code Generation

copy

Full Screen

1root.child.doSave();2root.doSave();3var root = require('nodejs-root');4root.child.doSave();5root.doSave();6root.doSave();

Full Screen

Using AI Code Generation

copy

Full Screen

1var root = require('Root');2root.doSave();3Root.doSave();4## How to use the module in the browser (without any bundler)5Root.doSave();6## How to use the module in the browser (without any bundler)7Root.doSave();8## How to use the module in the browser (without any bundler)

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful