locked
ASP.net AJAX database operations and partial page update RRS feed

  • Question

  • User1194656299 posted

    Dear All 

    I am very new to AJAX, Jquery and JSON, so please do not consider this question as simple. 

    I am developing an eCommerce website using ASP.net WEBFORMS. I need to implement jquery ajax such that all operations occur without a page reload. If any user click on Add to cart, the operation should happen in background without page reload with a success message at the end. Similarly in the product list page if they select a price range or brand, the product should display in the right panel without page refresh. Registration/login also in the same way.

    Can any one provide sample code or any articles which help me. One thing I feel difficulty in searching is that most of the result I am getting is in MVC. I dont want to use MVC for the time being, 

    Please anyone help me

    Thank you

    SAJ

    Monday, October 12, 2015 11:48 AM

Answers

  • User61956409 posted

    Hi SAJ,

     I need to implement jquery ajax such that all operations occur without a page reload. If any user click on Add to cart, the operation should happen in background without page reload with a success message at the end. Similarly in the product list page if they select a price range or brand, the product should display in the right panel without page refresh. Registration/login also in the same way.

    Firstly, you could call web method to add product to cart (insert a new record to database) using jQuery AJAX. Besides, To filter products based on price range or brand, you could pass price range or brand as parameters to web method, then you could dynamically recreate product list based on returned data in AJAX success callback function.

    Secondly, the following articles will be helpful.

    http://www.aspsnippets.com/Articles/Calling-ASPNet-WebMethod-using-jQuery-AJAX.aspx (how to call web method using ajax)

    http://www.aspsnippets.com/Articles/Search-GridView-with-Paging-on-TextBox-KeyPress-using-jQuery-in-ASPNet.aspx (how to filter data and recreate html)

    Best Regards,

    Fei Han

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, October 12, 2015 10:29 PM