Frage

I am not able to understand the flow on this page

how they are doing in MVC http://demo.nopcommerce.com/onepagecheckout till now i created only one button for one page (view ) or provide me some similar link or similar code so i can understand

i want to implement same in my application

Thanks in Advance

War es hilfreich?

Lösung

The page is using AJAX to achieve the effect. Let's go through how it works.

The page is divided up into four sections.

  • Billing Address
  • Payment Method
  • Payment Information
  • Confirm Order

Each section is treated separately and are likely rendered using partial views. Each section has it's own form. When the user fills out a section and then submits that section, the form is submitted to a particular action. The Billing Address section submits its form to /checkout/OpcSaveBilling, the Payment Method section submits its form to /checkout/OpcSavePaymentMethod and so on.

When these forms are submitted (asynchronously, remember), the server handles the business logic and the validation and returns a result in the form of JSON. The JSON describes what happened, i.e. the result of the validation (success or fail), any errors that occurred and also contains HTML that the page can use to redisplay that particular section.

How is this data being remembered? Sessions. When forms are successful in their submission, the form data is stored per user in the session data. This way the system knows each user's settings and also knows where they are up to in the process.

The final step, Confirm Order, doesn't bother sending any form data because the server already knows everything through the session information.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top