We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
AJAX: Get Current Location
Topic Started: Dec 16 2016, 01:49 AM (563 Views)
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
When AJAX is used, when viewing a user profile or the online list it will say the user is currently viewing whatever the HTTP GET location is and not the actual page the user is currently viewing. To prevent this we coders can simply add this to our scripts:
Code:
 
$.get(location.href);
Here's the problem with us doing that: If, for example, a user has 5 scripts on their board that use AJAX, using the tiny, one line of code above will perform 5 additional requests.

My proposal: Make this a universal change for all forums across the network. If AJAX is detected on a page, trigger the above code to be the last code to load to grab the users current location. Perhaps Brandon has a better JavaScript or PHP alternative that I'm not aware of. Whatever code be used to fix this, I think it does need to be a universal change to all forums across the network to prevent bandwidth from being eaten away and to prevent coders from adding that line of code to every AJAX code they post. Using the above example, 5 scripts that use AJAX and 5 additional AJAX requests just to determine the current location of the user can be trimmed down to 6 total HTTP GET requests instead of 10, that is if the above code or some other form of AJAX were to be used. If no additional AJAX has to be used, then that's just 5 requests, which is what the codes were meant to perform anyways.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Service Discussion and Feedback · Next Topic »
Add Reply