Ajax call not wokring in IOS

Hi Team,

I am using latest version of Cordova and testing on I-Phone 11 with IOS software version 14.4.2.
Every time I make a call my Ajax request is failing in IOS but works fine on Android.
When I hit on login page it makes an Ajax call and it fails.
Error :
Notework Error : A Network error occured.

Some people had face the same issue when I searched but somehow the solution they have posted is not working for me.
I have tried the Ajax call with both URL http and https but with no luck.

Below is how my config file looks.

<platform name="ios">		
	<preference name="WKWebViewOnly" value="true" />
    <feature name="CDVWKWebViewEngine">
        <param name="ios-package" value="CDVWKWebViewEngine" />

    <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" />
              <icon src="resources/VineaMobMgrIcon.png" width="180" height="180" />
              <icon src="resources/VineaMobMgrIcon.png" width="60" height="60" />
              <icon src="resources/VineaMobMgrIcon.png" width="120" height="120" />
              <icon src="resources/VineaMobMgrIcon.png" width="76" height="76" />   
			  <splash src="resources/splash.png" width="320" height="480"/>				  
	<!-- <engine name="ios" spec="5.1.0" /> -->
	<plugin name="cordova-plugin-whitelist" spec="1.3.1" />    
    <plugin name="cordova-plugin-device" spec="1.1.4" /> 	
	<plugin name="cordova-plugin-wkwebview-engine" />
	<plugin name="cordova-plugin-cleartext" />
	<plugin name="cordova-plugin-network-information" />
	<plugin name="cordova-plugin-wkwebview-file-xhr" source="npm" version="3.0.0" />	
  <access origin="*" />
  <allow-intent href="*" />
  <allow-navigation href="*" />  

Ajax request:

        url: url,
        cache: false,
        async: false,
        data: JSON.stringify(params),
        type: "POST",        
        dataType: "json",
        contentType: "application/json",
        success: function (data)
 error: function (request, status, error)
            showError("in failure");
            showError("Error " + error + status + request.status);
            ajaxLoadingHide(); /* showError(error); */

Can you please advise anything to fix this issue or to find the root cause for it.



It looks like VoltBuilder is doing its job properly.

Can you get any more information, either on the server or client side?

You need to send this header on the server side:

This is a PHP example:

header("Access-Control-Allow-Origin: *");
1 Like