Hello, how to initialise AngularJS app after AJAX ?
AJAX is separate from AngularJS, so i have bugs with it, it doesn't display the values.
What to do ?
You will need to trigger Angular's digest cycle with a call to $apply().
Alternatively, you can use the built-in services to get data over AJAX, $http or $resource. They'll take care of initiating the digest cycle when data arrives.
Related
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 ?
I would like to implement search function on Django
but I have to do it with Ajax.
I have to know that how Django will connect with Ajax
and do query to search in real time character by character.
Is there any how to or document to implement it?
Thank you.
Yes you can.
You need to add CSRF token in your ajax calls (javascript files)
Create a view and handle the ajax request (django views file)
Perform your ajax request and handle the response.(javascript files)
Here is a tutorial, how to use ajax in django
I am integrating react.js with drupal and I am requesting json file through ajax every 2 seconds which is not best practices so I want to cache the results and I read somewhere that (react.js lacks the ajax capabilities)
so how it is possible to cache the results?
You can use WebSockets with React so that you do not have to poll the server (i.e. send repeated ajax requests at a given interval). With React, you normally store the data received from the server in state using the setState method (http://facebook.github.io/react/docs/component-api.html). Then any time the state data is updated, React will diff the DOM and re-render necessary components.
Do you have any code samples? Are you using any library / framework for your models? I would suggest abstracting network requests out of views into some sort of data model, whether that is Backbone, Angular, Flux Architecture, etc. There you can decide whether you want to poll the data, use WebSockets, or request the data based on a change of state in your view.
I want to know whether making ajax request using webworker has any advantages over making an ajax request directly within the DOM.
By making ajax requests in webworkers you can save the performance of APP. ajax request from DOM will eat the app performance and may some times block app UI. The safe way processing high computation is doing it in webworker.
is there any reason to use the post-redirect-get (prg) for a request that you know will only happen via an ajax request?
in this scenario, you might have a request that is sent (either via ajax or direct), and we're assuming on the back-end we can distinguish which is which. In the case where the direct request is handled using prg, is there any reason to also handle the ajax request with a prg too?
or can an ajax post just be responded to directly?
For something that only uses AJAX, I can't see a reason to use prg. Since it is not a user controlled action with the possibility of duplication, the only way the AJAX call would be duplicated is if the original page was refreshed before the action finished, and since prg has that same one flaw, you may as well use the direct approach.