php - Why is ajax waiting for over a second? -


i'm having bi of issue. when make ajax request, goes through fine, status waiting on 1 second. seems high me.

here screenshot of network tab in chrome network tab

here ajax function using.

function subcommentsubmit() {         $('.subcomment').on('submit', function() {              var url = "/laravel/public/utility/submitsubcomment"; // script handle form input.             // submits data ajax, method type post             var currentelement = $(this);             var thatpar = currentelement.parent().parent();             var livesubcommsection = $('> .live-sub-comments', thatpar);             var commentloader = $('> .loader-comments > .loader', thatpar);              var formdata = currentelement.serialize();             $('.new-reply', currentelement).val('').blur().trigger('autosize.resize');              commentloader.removeclass('hide').fadein(250, function() {                 $.ajax({                        type: "post",                        url: url,                        data: formdata, // serializes form's elements.                        success: function(data)                        {                                 commentloader.fadeout(250, function() {                                 commentloader.addclass('hide');                                 var response = json.parse(data);                                    var commentpost = $('<li class="single-user-reply"> <div class="user-ava-cont"> <a href="'+ response.userid +'" class="user-ava-a"><img src="../images/avatest1.png"> </a> </div><div class="s-w-user-details"><a href="'+ response.userid +'" class="s-w-poster upop">'+ response.username +' </a> <span class="s-w-timestamp">1 second ago</span><a href="#" class="likes-but notliked active">like</a> <a href="#" class="likes-but liked">liked</a><ul class="more-dropdown-cont" role="button"> <li class="dropdown minidrop"><button class="more-dropdown dropdown-toggle" role="button" data-toggle="dropdown"><i class="icon down"></i></button><ul class="dropdown-menu" role="menu" aria-labelledby="people"><li role="presentation"><a class="u-a-a" role="menuitem" tabindex="-1" href="#">block user</a></li><li role="presentation"><a class="u-a-a" role="menuitem" tabindex="-1" href="#">report abuse</a></li></ul></li></ul><div class="s-w-user-post">'+ response.comment +'</div><div class="clear"></div></div></li>');                                 commentpost.hide();                                 livesubcommsection.append(commentpost.fadein(250));                                  subcommentsubmit();                             });                        }                 });              });             currentelement.unbind('submit');             // ensures doesn't route form normal way, , ajax takes on             return false;          });     } 

i profile php file because seems source of issue.

i not familiar laravel's profiling options simple can this:

class utility{      function submitsubcomment(){         $start = microtime(true);          //your code here          echo (microtime(true) - $start);     }  } 

good luck!


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -