Ajax page echo vs background Ajax / HTML direct manipulation?

I have a dilemma, and I could really use some advice. I am creating an ordering system with PHP / Smarty / HTML / jQuery. He is currently working on a site where the seller will confirm the orders.

I need to have 3 divs.

  • Pending orders div - contains a table with unprocessed orders
  • Last orders div - contains a table with the last processed orders (10-20 rows)
  • Details div - contains order information and confirmation / reject buttons

This is a typical situation with master parts, only the master is divided into 2 parts (1,2), and the details are in div 3. Naturally, everything is connected with javascript / Ajax, so the user can get the feeling "in real time". Pending div orders are filled with the comet method (long survey).

My dilemma is how to connect a div with javascript / ajax. Should I create echo pages that match the db state and fully load in the div. Or should I only manipulate the rows of the table and use ajax only for background db calls?

To make yourself clearer:

Option 1 (full Ajax pages):

  • when the user selects the wait order, a new page (echo table) is retrieved using ajax and loaded into the details div
  • when the user confirms / rejects the order in div 3, divs 1 and 2 are updated using ajax (echo pages with tables that correspond to the state in db)

Option 2 (html manipulation / background Ajax):

  • when the user selects the waiting order, div 3 elements are filled with a new value.
  • / div3, tr div 1 ( ajax del db), tr div 2 ( ajax db)

, ?

+3
1

acceptabale, nr 1 , reload div 1 & 2. - div 3, , , / tr ( , , ).

2, , / tr, , tr , , .

, , 2 ;)

PS. overlay ajax loader (http://ajaxload.info/), , div 3. , , - ;)

+1

Source: https://habr.com/ru/post/1789049/


All Articles