My Meteor app cannot make ajax call to my webapi if it is running on ios iphone, but can call ajax to my webapi running as meteor app

My Meteor app cannot make ajax call to my .Net WebAPI if it is running on ios iphone, but can call ajax to my webapi running as meteor app. I compiled my meteor app with XCode 8.0 and Meteor 1.4.1 and target is iOS 10 for iPhone 6 Plus.

Can someone provide me some hints and possible solutions?

Below is my code snipped: All codes are running within the controller.js without calling meter server codes. the mmResults arrow is a reactive variables which is being binded to the UI controls in the html file which is not important in this question. I am hoping to know why this piece of codes able to call the webapi successfully, but failed if running within the iOS 10 iPhone 6. Thank you in advanced.

Is there any setting for Meteor related to Ajax call on the client (running within iOS iPhone) not on the Meteor’s Server Side? I am not calling Meteor Server side codes (this means that I am not creating Meteor Server Methods and publishing the methods. Everything is client side.

Also the UserToken is currently being ignored so it is okay to pass UserToken as empty string.

Also the startDate and endDate are being overwritten with specific date.

$scope.MMResults = function (startDate, endDate) { //alert(‘in MMResults()’);

var username = ‘myemail@gmail.com’;
var password = ‘mypassword’;
var state = ‘ca’;
var game = ‘mm’;
var gameType = ‘mm’;
var numberType = ‘mega’;

url = 'http://pAPI.mydomain.Com:81/Api/GlgResults';

//alert('in ajax call now');
$.ajax({
    type: "POST",
    traditional: true,
    url: url,
    contentType: 'application/json; charset=utf-8',
    dataType: "json",
    data: {
        Username: 'myemail@gmail.com',
        UserToken: '',
        State: state,
        Game: game,
        GameType: gameType,
        NumberType: numberType,
        StartDate: '2016-01-01', //startDate,
        EndDate: '2016-12-30', //endDate,
    },
    success: function (result) {
        //debugger
        //alert('in ajax call success');
        $scope.MMAjaxToMMResultsSuccess(result);
    },
    error: function (xhr) {
        //alert('in ajax call failed!');
        alert(xhr);
        alert('Request Status: ' + xhr.status + ' Status Text: ' + xhr.statusText + ' ' + xhr.responseText);
    }
});

}

$scope.MMAjaxToMMResultsSuccess = function (data) {
//alert(‘in MMAjaxToMMResultsSuccess()’);
//alert(‘in PBAjaxToPBResultsSuccess’);
//alert(data);

var jsonData = JSON.parse(data);

var length = Object.keys(jsonData).length;

if (length > 10) length = 10;

for (var i = 0; i < length; i++) {
    var item = jsonData[i];
    var drawndate = item.Draw_Date.substring(0, 4) + "-" + item.Draw_Date.substring(5, 7) + '-' + item.Draw_Date.substring(8, 10);

        $scope.mmResults[i].date = drawndate;
        $scope.mmResults[i].col1 = item.Number_1;
        $scope.mmResults[i].col2 = item.Number_2;
        $scope.mmResults[i].col3 = item.Number_3;
        $scope.mmResults[i].col4 = item.Number_4;
        $scope.mmResults[i].col5 = item.Number_5;
        $scope.mmResults[i].col6 = item.Number_0;

}

}

I have created a file called “mobile-config.js” and place it at the root of my application and it solved the ajax call that I have problem with cross domain.

The contain of the file is as followed:

App.accessRule( {tel:’*’} );
App.appendToConfig(’’);

NOTE: Since Meteor 1.4.x cross domain is turn off by default.

This allows my app to perform ajax calls from iOS device (my iPhone 6 Plus) to .NET Web API.

Thanks everyone for the hints.

Brian