Load part of the page in AJAX

Asked

Viewed 480 times

1

I’m doing an app. The application has a top, side menu and contents according to the selected menu.

In the content the user can add, remove, change and my question is: for example, when adding a new record I must update the content via AJAX, since everything else will remain the same?

I think with AJAX the answer is a little slower, am I right? In that case it was better to carry normally?

  • @Miguel Angelo thanks for editing but I’m in Portugal, here it says registration and no registration.

  • I’m sorry! I’ll remove the 'r' then. = D

1 answer

0


In fact the answer via ajax is faster, because you will have less data moving through the network/ internet.

For example, when deleting something, you can make an AJAX for a specific URL, and then return a JSON that contains only a true or false value, indicating whether it was deleted or not.

This is much better than reloading the entire page, and much faster... the only problem is that you will have to do some manipulations via javascript.

  • I’m using jquery and not pure javascript, maybe that’s why... the problem is that I can’t return a true/false. For example, I have a list with several records, I edit a record, I record... I have to "rebuild" the list and I needed to assemble all the html.

  • true/false was a specific exclusion example. In the case of insertion/editing, you could return a JSON with the edited data and rebuild using jquery, or return only the part of the page that needs to be changed and used $.load for example, which is part of jquery, and which allows you to replace parts of the page via AJAX.

  • Okay, thank you, I will use AJAX in these cases, I no longer remember the $.load.

  • Need guidance just talk.

Browser other questions tagged

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