jquery-callback

jquery animate function callback

流过昼夜 提交于 2021-02-02 09:50:11
问题 I have a jquery animate function with a callback that isn't firing, I think it's something simple that another pair of eyes will pick up quickly. This is the code: $('#base_back_img').animate({ width:372, height:389, marginLeft:0, paddingTop:0, marginTop:1 }, {duration:300, queue:false}, function() { $('#menu-text').css({ display:'block' }); $('#mini-menu').fadeOut(); }); 回答1: When using animate with an object as argument, you need to use complete just like that : $('#base_back_img').animate(

jquery animate function callback

筅森魡賤 提交于 2021-02-02 09:46:41
问题 I have a jquery animate function with a callback that isn't firing, I think it's something simple that another pair of eyes will pick up quickly. This is the code: $('#base_back_img').animate({ width:372, height:389, marginLeft:0, paddingTop:0, marginTop:1 }, {duration:300, queue:false}, function() { $('#menu-text').css({ display:'block' }); $('#mini-menu').fadeOut(); }); 回答1: When using animate with an object as argument, you need to use complete just like that : $('#base_back_img').animate(

jQuery callback after append

大憨熊 提交于 2020-01-23 17:34:07
问题 I have the following code: HTML <div id="body"></div> JS var site = { 'pageData' : [ { 'loadInTo' : '#aboutUs', 'url' : 'aboutUs.html', 'urlSection' : '.sectionInner' }, { 'loadInTo' : '#whatWeDo', 'url' : 'whatWeDo.html', 'urlSection' : '.sectionInner' }, { 'loadInTo' : '#ourValues', 'url' : 'ourValues.html', 'urlSection' : '.sectionInner' }, { 'loadInTo' : '#ourExpertise', 'url' : 'ourExpertise.html', 'urlSection' : '.sectionInner' } ]} for(i=0; i < site.pageData.length; i++) { var loader =

jQuery callback after append

雨燕双飞 提交于 2020-01-23 17:34:06
问题 I have the following code: HTML <div id="body"></div> JS var site = { 'pageData' : [ { 'loadInTo' : '#aboutUs', 'url' : 'aboutUs.html', 'urlSection' : '.sectionInner' }, { 'loadInTo' : '#whatWeDo', 'url' : 'whatWeDo.html', 'urlSection' : '.sectionInner' }, { 'loadInTo' : '#ourValues', 'url' : 'ourValues.html', 'urlSection' : '.sectionInner' }, { 'loadInTo' : '#ourExpertise', 'url' : 'ourExpertise.html', 'urlSection' : '.sectionInner' } ]} for(i=0; i < site.pageData.length; i++) { var loader =

jQuery AJAX custom function and custom callback?

倖福魔咒の 提交于 2020-01-21 07:13:05
问题 Heylow everyone! I have an ajax() call like so: $.ajax({ type: "post", url: "whatever.php", data: { theData: "moo moo" }, success: function(data) { console.log(data); } }); Is it possible to wrap this inside a custom function but retain the callback? Something like: function customAjax(u, d, theCallbackStuff) { $.ajax({ type: "post", url: u, data: d, success: function(data) { //RUN theCallbackStuff } }); } theCallbackStuff will be something like: var m = 1; var n = 2; alert(m + n + data); 回答1

jQuery AJAX custom function and custom callback?

ε祈祈猫儿з 提交于 2020-01-21 07:12:10
问题 Heylow everyone! I have an ajax() call like so: $.ajax({ type: "post", url: "whatever.php", data: { theData: "moo moo" }, success: function(data) { console.log(data); } }); Is it possible to wrap this inside a custom function but retain the callback? Something like: function customAjax(u, d, theCallbackStuff) { $.ajax({ type: "post", url: u, data: d, success: function(data) { //RUN theCallbackStuff } }); } theCallbackStuff will be something like: var m = 1; var n = 2; alert(m + n + data); 回答1

Ajax .done() don't work together for me

隐身守侯 提交于 2020-01-17 05:07:08
问题 I have a very strange situation. I have an AJAX function which sends form data to a php codeigniter controller, on json response, it has to deal with the response. first part is working, but later part, which is a .done() function, doesn't work, no matter what I try. here is my script: var validator = $('#register-company-form').validate({ rules: { title: { required: true, valueNotEquals: 0 }, /* rules here */ }, highlight: function (element) { $(element).closest('.form-field').addClass(

Treat callback response in $.ajax() as JSON

此生再无相见时 提交于 2020-01-06 04:06:48
问题 I have: <script> $('#email').on('blur', function(){ email = $(tihs).val(); $.ajax({ type: "POST", url: "ajax.php", data: { 'email': email, 'job': 'check', }, dataType: "JSON", success: function (response) { // the response from PHP is smth like: // {"status":"failed","reason":"email_not_validated"} // now I want to: if(response.status == 'success'){ }else{ } } }) }); </script> This seems to work on every browser except IE , why is that? Am I doing the right thing? the only thing which I need

Treat callback response in $.ajax() as JSON

狂风中的少年 提交于 2020-01-06 04:06:24
问题 I have: <script> $('#email').on('blur', function(){ email = $(tihs).val(); $.ajax({ type: "POST", url: "ajax.php", data: { 'email': email, 'job': 'check', }, dataType: "JSON", success: function (response) { // the response from PHP is smth like: // {"status":"failed","reason":"email_not_validated"} // now I want to: if(response.status == 'success'){ }else{ } } }) }); </script> This seems to work on every browser except IE , why is that? Am I doing the right thing? the only thing which I need

my jquery fiddle isn't working

时间秒杀一切 提交于 2020-01-03 18:33:10
问题 My fiddle only shows part of what I'm trying to do, but since I can't even get the first part to work, I didn't try to add the second part. First part There's 2 forms. the second form is invisible because its class is set to "display: none;" What I want to do is, when you hit "send" on the first form, it fades out, and then the class changes on form2 so that it becomes visible. My fiddle shows my feeble attempt at this http://jsfiddle.net/mjmitche/KvwGw/ Note, I'm a newbie so please provide