Will AJAX calls work from ionic framework?

Hello, Does Ajax calls works from ionic framework. Inside Controller.js I am trying to make a ajax which is not getting called.

getChanges: function(syncURL, modifiedSince, callback) {
alert('Inside Get changes');
        url: syncURL,
        data: {modifiedSince: modifiedSince},
        success:function (data) {
            log("The server returned " + data.length + " changes that occurred after " + modifiedSince);
        error: function(model, response) {


I am able to see alert message. After that app does nothing.It is not even throwing an error. Any idea?

You are using jQuery. Ionic is built on top of AngularJS which out of the box only supports a very slimmed down version of jQuery (jQuery lite).

Read up on Angular’s version of what you’re trying to do here:


To expand upon what has been said above it is possible to use the full version of jquery. You need to add it above where you add angular in your index.html.
I’d advise using the $http service first to see if it does what you want.

Thank You. Seems like I need to use $http. But, I making ajax call in a javascript object which I created.
How to pass $http to Java script object?

Have you looked at the documentation? There is an example in there for a factory that uses $http.

works fine in code we have moved across before changing to use $http so it should work for you.

How/where are you calling getChanges()?

Here is my code

window.dao = {
sync= function(){
Here is my ajax call

Here is my controller
.controller(‘DashCtrl’, function($scope, $http) {

$scope.syncdatabase = function(){
    	   	alert('Sync DB');
    	   	dao.sync( );

Now How can I pass $http to Sync method? Thanks for looking in to. Appreciate it.

can some one reply to this? How to make $http ($Ajax) call from javascript object?

Here is my problem, let me know if I miss soem thing here.
I createad a java script object where is perform all operations on local daatabse. Now, when ever I need to get data from server I have to make external call using $http. Now How can I pass $http instance to my java script object?`

window.dao ={
syncURL: "../api/employees",
 initialize: function(callback) {

     createTable: function(callback) {
    dropTable: function(callback) {
     Sync: function(callback) {
		    url: syncURL, 
		    method: "GET",
		    params: {modifiedSince: modifiedSince}
         		alert("The server returned " + data.length + " changes that occurred after " + modifiedSince);

Now can some on eplease tell how to make $http call inside java script object?

Your object should probably be a angularjs service. Then you inject your service into the controller and inject the controller in the html and call some function of the controller.

You should not create your own javascript object. Maybe have a look here: http://viralpatel.net/blogs/angularjs-service-factory-tutorial/

You really should read a angularjs beginner tutorial to get familiar with the concepts. Ionic makes a lot of use of these things. You can find a lot of good short videos here: https://egghead.io/technologies/angularjs