|
How to make AJAX request only when it needs to?
|
|
22nd November, 16:32
Post: #1
|
|||
|
|||
|
How to make AJAX request only when it needs to?
Hi, I'm using qTip to display member profile cards on our site.
The same card could appear on the same page multiple times so I have decided to store the member info in JS so it won't make the same request multiple times. In my code, I check if the member info already exists in JS in the context.text function. But the content.ajax would still be triggered and make a new ajax request. Is there any way to disable the ajax part in such scenario? JS Code
|
|||
|
23rd November, 01:38
Post: #2
|
|||
|
|||
|
RE: How to make AJAX request only when it needs to?
Well ajax.once is enabled by default (http://craigsworks.com/projects/qtip2/do...ax/#once). This means the AJAx request is only fired once for the lifetime of the tooltip unless you trigger it by setting an ajax option. So you don't actually have to clear the AJAX stuff with that .set() call, as it won't do anything after the initial grab anywho.
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
23rd November, 10:36
Post: #3
|
|||
|
|||
|
RE: How to make AJAX request only when it needs to?
That only applies to one single tooltip. I'm trying to prevent multiple loading of different tooltips which would load up the same content, ie. one member can leave multiple forum message in one thread and each member should require only one AJAX load.
|
|||
|
23rd November, 18:01
Post: #4
|
|||
|
|||
|
RE: How to make AJAX request only when it needs to?
Ok then move the content calculator and stick it in your each statement instead, then check if its actually present before you define your AJAX object:
JS Code
Craig Thompson Web Developer / Designer Craigsworks http://www.craigsworks.com |
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)

Search
Member List
Calendar
Help




