I'm having a hard time figuring out how to do this,
Heres what I am trying to do:
I have a webpage containing statuses of users I've chose to follow(Something like facebook's statuses).
Now what am trying to do is to refresh the webpage automatically so that whenever a user changes his status I won't have to refresh the webpage to see it.
The status list is a Repeater located inside an UpdatePanel, it's data source is structure of List<User> I've created(there is no DB involved). Each user has an unique ID, name and status.
The users I follow is a List of strings containing the IDs of those users stored on the Session.
I have read countless articles about how to use a webservice and how to use javascript yet I remain clueless on how refresh the updatepanel's content automatically through the webservice.
Good example of using a timer (for an update panel) here:
http://msdn.microsoft.com/en-us/library/cc295400.aspx
Assuming you are using JQuery you can then call a webservice from this 'Timer_Tick()' method using the following:
JQuery & Timer :: Updating the text of a hyperlink from a webservice
Related
I recently came across a feature that Salesforce Applications have, i.e. when we log out, the tabs opened during the session are preserved and are displayed again when we log back in at a later point of time.
I would like to implement something similar in my web application where I would like to retain the dynamically created DOM elements so that if I refresh the page or logout, those elements still are displayed unless the end user decides to delete/close/destroy those elements.
Has anyone implemented anything that sounds familiar? If yes, what would be the ideal way to go about it?
Appreciate the help!
I have a webapplication that holds users and adresses as well as various different values. I have implemented a review function as a helper if you go through your data on an infrequent basis. It marks each value as reviewed or not. As this feature is only a helper and a review flag or timestamp is not needed and implemented in the DB, I save an array of data as a JSON string locally using localstorage.
This is enough for my case. You could do the same for your datamodell. You can of course also save this data per user on a separate table in the db. Consider something like: id, userid, featurename, etc.. with this generic layout you can save the state for each feature of your app, be it a tab, a modal, a setting or whatever.
Of course, you need a (preferably JS) function that gets these settings and then can recreate the DOM elements or fetch them via AJAX. You need as well a function that sends an AJAX request to save the information that a feature/window/tab has been opened/closed/etc.
A lot of work for a "nice feature". Might not be a top priority on your bucketlist, but definitly enhances your user experience.
I refresh the page or logout, those elements still are displayed
unless the end user decides to delete/close/destroy those elements.
That can only be possible if before refresh/logout those dynamically created elements are stored.
That can be possible by either storing the value in database or using local/session storage.
Values of the dynamically generated elements can be stored in localStorage like
localStorage.set('someKeyName' ,'value of dynamically generated Elements in string format')
Then after refresh retrieve the values and create those elements and append it to dom
I'm developing a Angular App using Restangular with Web Services REST, but when I change between sessions several user the information have a delay to display information. for example a view CustomerDetail with Information of User1 but when I change a User2 then it show me information of User1 and later in n seconds show information correctly the user User2.
My question is, how to reload information correctly in view?
first of all, try reducing server calls by getting as much data at once and then create client side reload. regarding your case, when you click on some button to change users, first change a variable to "onLoad" to true and perform ng-show="onLoad" for some loading div and ng-show="!onLoad" for some other div contains users info. then when you get back your data flip "onLoad" value...
I have some code that does a jQuery post to my API, does some magic, and then uses Pusher to push data back to the browser.
Currently I am using Sinatra, pulling the session id, and putting it in a hidden value on the html. And then when my JS function is triggered by my button push, it pulls this value, and passes it to the API. Then my code just remembers and sets this as the channel ID and pushes data back.
It works quite well...except if I have more than one browser open, both have the same session id. So triggering my API on one pushes data to all open instances I have. My question is: is there a "best practice" way to do this and differentiate between tabs?
I could of course just generate a random number with JS and use that as my value, but for some reason it just seems wrong. Thoughts?
I'm writing a blog program ... as a little programming exercise for myself. The blog has a front-page (index.php), which contains a div showing all the posts. The div also contains links allowing users to filter what they see on the page with an AJAX function, which calls updatePage.php to request the filtered results from the server and update the div with the result.
Every time users click on the links, the page does two things - 1) set a cookie (with javascript) containing the user's filter request; 2) call updatePage.php, which uses PHP to read the request info from the cookie, then request data and update the div according to the request.
However, updatePage.php doesn't seem to be reading the cookie set in the AJAX function (returning an empty result). I pause the AJAX function in the debugger, and see that the cookie is set before updatePage.php.
Any idea what may have gone wrong here? Thanks!
Jeff
Im new at web developing.
I want something like:
A website, that everyone can enter. on the website u have 2 parts: one is filled with textbox so any user can write something in it and click button 'save comment'. He other side is filled with the execution of that button(it displays added text comment -but not just for a moment but that text is saved on that website). Simple as that...
Do i use java script?
Ive been looking for the answers but kinda didnt know how to ask gooogle bout that
scheme on that website:
----------------------/----------------
-textbox--------------/--constant text-
--add comment button--/--wrote by user-
----------------------/----------------
You have many possible ways to do that. One of the ways is to use html with jquery and send the result via web service (.asmx for instance) and save that result in a database (MSSQL for instance). So everytime you load the page you can get those saved results and display it on the relevant page. Another way is to use php with mysql or to use java...
If you don't want to use databases and server side code you can save the results in a cookie and then display those results in the page.