.load() affects website performance

Asked

Viewed 52 times

1

I would like to know two things, and if possible an example.

I have a system of comments that after sending and writing in the database and appears without refresh, almost equal to the comments of facebook. At the moment I’m making the comeback by .load() to add html with variables. Is this harmful? The .load() slows down?

I was going to do via .html(), but there are several lines, the html of the comment is great (because it has the photo, name, date, menu, everything in the space of the comment) and I thought it would be more organized by .load(), where I pass the variables by jquery, it adds to html and then puts it into <div> with the .load().

Is there any more effective way or the .load() does not slow down the system?

I’m afraid when I get the site up and running, if I get too many comments, I’ll slow down...

  • The load is probably slower than the . html because it parses the response (if the document is text/html for example) and tries to extract and execute tags such as <link> and <script> that came from this request. However in your case I believe the problem may be another.

  • But I can pass an html with 20 25 lines by . html() ? I tried yesterday and gave error, always show small examples...

  • I don’t understand, I think Voce is having multiple problems, am I right? What I said is that the load tries to parse the data

  • @Diegocamilodebittencourt a tip, for each distinct difficulty ask a question. It is also interesting to see snippets of your code where you are with this doubt, it is difficult to assess whether this error you mention is in how you use this function or in something else, with the code will be easier to analyze.

  • Actually I have no problems, the system works very well even... the load works that I got good... but then said it would be better to do in html, the database data I get by jquery in Success, then I could put the html and replace the user data and comment with jquery, this also makes quiet. And how to put so many lines of html effectively by jquery, the one that I was half in doubt... . html() ? can put 20 25 lines?

  • 1

    Diego, as I said, can do with . html both with . load, which will affect this and the type of response that is being received by . html (I believe you are using ajax). If you are receiving html then the request, parse and render will be slower anyway. This is not a certain thing to answer, because the problem can vary with the answer you are receiving in .html. Therefore I repeat friend, the problem is not well with the . html but "probably" with your application.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.