jquery - Concept: Where to save data which is relevant for every ajax call? -


I am working on a large website. This website is a single page application with 100% no request and only AJAX calls. Ajax calls have different receivers as the website is very modular based. (For example, the News module calls AjaxNumSpace, Transport Module Ajaxtransport.aspx calls.)

In FranceSide I have a lot of javascript, with lots of jquery, ASP.NET in backend in C # An MS SQL Database and Lynch

Now there is a new request, that we should be "split", a user can select a division and all modules are filtered on this division setting, e.g. Division 10 has one more news, then split 50 and so on ...

This division has a simple drop down on the front-end, because every time you press F5 No data left of this division is left on backend but I need information on backend because every request is based on this information because I have to filter the database queries in the database queries!

How to store such information and how to maintain it?

I have only the idea that it needs to be stored in the session, for example on a new beginning I write the session with the default division for every user and the user with the dropdown drop down, the session division Replace with AJAX call and whenever I need it when its session is required, right? Is this the best solution?

I think the best solution should be a dropdown client side with data attribute foreach elements (eg Data-Wall = 'Partition 1') So you can recover that value from jQuery (eg. $ ('# DropdownID'). Attr ('data-val')) and call it as your AJAX parameter .

html / js example:

  data =" partition = "+ $ ('ddTest'). Attr ('data-val'); $ .ajax ({type: "post", url: "/ ajax / division page. Espx", data: data, success: function (result) {// do something}});  
  & lt; Select ID = "ddTest" & gt; & Lt; Option data-val = 'partition 1' & gt; Partitioning a & lt; / Options & gt; & Lt; Option Data-Val = 'Partition2' & gt; Split two & lt; / Options & gt; & Lt; / Select & gt;  


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -