Phonegap sends notifications inside ajax request - ajax

I am trying to get notification on android/ios. I have an ajax request inside a setinterval function, and I want it to notify me, when the ajax request turns true.
Can anyone ever try to do this or did this before?
I already try to use plugin push, but actually I don't know, how it works.

Related

Is it possible to make an AJAX request in Redux?

I am new to Redux. I tried different methods but I am not able to get ajax request in redux from server. Can you please tell me is there any middleware or other way to make an AJAX call through Redux ?

Example of Using AJAX Oauth call from Suitelet to call a restlet

I have been trying this for quite some time and with no avail. Would someone point me to the right direction.
I have a simple suitelet
the suitelet dumps a html in the response by reading a file
The html has a button. On ajax call of that button, a restlet gets called and a request is sent.
This is working great with Login and internal calls. However, I want the suitelet to be available without login and also the restlet.
When I do that, I get CORS error and using jsonp when I relsolve that, I get 401 Unauthorized
Tried Outh and NLAuth, no avail.
Will really appreciate any help or pointers.
If the info isn't sensitive you can call the suitelet from the domain of your website. If you have enabled https on the site then that'll just work
e.g. https://forms.na3.netsuite.com/app/site... becomes http://example.com/app/site...
If you are using SCA then you can also just do this by calling a .ss service function. The nice thing about that is that you can set the role on the .ss file and have better control of your resources without just making the customer center role capable of seeing everything. Same issue with https though.
If the info is sensitive you can get around the issue on most browsers by embedding an iframe at the https:// forms etc and using the onMessage operation to transfer info from the non-secure to the secure. (see https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage)
It's certainly possible to call a RESTlet from a Suitelet but it sounds like your issue is more how to call the Suitelet securely.

Multiple subscribe not working with enableProtocol:true

I am using atmosphere jersey with redis broadcaster.
When I keep enableProtocol:true in javascript, the first subscribe request is successful.
But when I send next subscribe request I get Continuation Frame warning. I tested on Google chrome. I have attached the snapshot.
What could the issue be?
It works when I keep enableProtocol:false. But then onDisconnect is not called in long-polling.
After some observation I found that the X-Atmosphere-tracking-id=0 in first request and in subsequent requests I get it as the tracking id of previous request.
How do I avoid this?
You can try by manually setting the tracking-id to 0 before each subscribe.
$.atmosphere.uuid = 0

How to catch AJAX requests in Webbrowser

How can I catch all the AJAX requests that a page makes with a Webbrowser / EmbeddedWB? BeforeNavigate2 unfortunately isn't fired for AJAX requests.
For example: requests which are made when you type in google search bar.
If the environment is under your control. you can use a custom HTTP proxy (based on Indy for example).
See: Indy's TIdHTTPProxyServer: How to filter requests?
Ajax requests can be detected based on their specific header:
How to differentiate Ajax requests from normal Http requests?
Update: this question on the Microsoft web forum has an accepted answer:
AJAX detection in WebBrowser control
If I were you, I would've injected my own script into every page after it's been loaded. This a script that captures all AJAX requests and informs the application.
Using the following code, you may capture every AJAX request made by jQuery (Haven't tried, but I don't think it works for non-jQuery AJAX requests).
$.ajaxSetup({
beforeSend: function() {
// before sending the request
},
complete: function() {
// after request completion
}
});
It's not even a code, but it can give you a clue for what you want to do.
Surely using this method, you're gonna need to somehow communicate with your application. For instance, I'd use my made up protocol and a new window command so that my Delphi component will be able to capture and parse the event.
As I said there are plenty options here and I'm just giving a clue.

Grails 2 - Too many Ajax calls will invalidate user sesssion

*update: sorry, i didn't give a context. I'm using Grails 2.1.2 with the spring security plugin installed. Js lib -> jQuery (latest)
I have a page that submits lots of synchronous ajax calls (not my design, sorry). After the 25th call i see from firebug that i start getting http 302 status, then the handler for ajax calls when there's no user session is called (loing/authAjax in my case). My particular handler sends an http 401. In any case why is the session expiring? This happens only when i submit tons of synchronous ajax calls. Is there any limit to the number of ajax calls? Is it documented anywhere? Making async calls is not an option in this case because these ajax calls make db updates on the same table and that would result in a hibernate lock exception.
I'm not asking for a fix, i know how to fix this (by doing one single ajax call). What i'm asking is why the session is being invalidated? Any ideas?
Did you try to set the cache setting to false in your calls with jQuery ?
302 means you're getting data from the browser cache instead of the server.
Hope this help....

Resources