Sending Data to Server from iOS Device (AJAX, HTTPS)

I've encountered an issue where I am unable to make an AJAX POST Request from my iOS (Cordova) App. The API URL has a secure certificate on www.myDomain.ch but not without the www prefix. Interestingly, when I tested the Request with a tool or in a React test application, it worked perfectly fine. However, when attempting to make the same request from my iOS App, it consistently results in a 403 error. I have experimented with different libraries such as jQuery Ajax, fetch, and axios, but the problem persists. Additionally, the Backend has CORS enabled.

Here is an example of how my AJAX call looks like:

$.ajax({
   url: 'myurl',
   data: JSON.stringify(dataObject),
   method: 'POST',
   dataType: 'json',
   success: function(data) {
      console.log('success', data);
   },
   error: function(err) {
      console.log('error', err);
   }
});

I am curious whether iOS requires a special HTTPS certificate or if there is something specific that needs to be added in the Request Header for this request to work properly?

Answer №1

Ensuring your app meets iOS App Transport Security requirements may require declaring the domain in your plist file. For more information, refer to the following link:

Understanding App Transport Security

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Save information entered into dynamically created input boxes in an array

I am currently working on a project to develop a website that generates timetables. However, I have encountered a roadblock in my progress. My issue lies in dynamically generating user-selected text boxes for subjects and faculties using a for loop. Unfor ...

Deploying NextJS: Error in type causes fetch-routing malfunction

Encountering a mysterious and funky NextJS 13.4 Error that has me stumped. Here's a summary of what I've observed: The issue only pops up after running npm run build & npm run start, not during npm run dev The problem occurs both locally and ...

Instructions for sending an email through a form while displaying a pop-up message

My Objective To create a functionality on my website where users can input their email addresses in a form and receive a validation popup indicating whether the email is valid or not. Background Information I am currently working on a website that allow ...

How to implement hover effect to show child div within parent div using React.js

Hey there! I'm fairly new to working with react js and currently trying to add some animation to a nested div. The parent div, known as " portfolio-product-item ", showcases a featured image pulled from the WP REST API. Inside this parent div, there&a ...

Difficulty with BCRYPT retrieving information from MySQL

As a beginner in programming, I've hit a roadblock and can't seem to find any solutions. I've managed to successfully register users into my database and hash their passwords. Now, I'm trying to implement a login feature for these users ...

Error Received While Attempting to Log in using Ajax

Having an issue with logging in using ajax and php. I am able to log in successfully, but when trying to display an alert message and refresh the page upon login, it gives me an error without refreshing. However, upon manually refreshing the page, I can se ...

Assessing personalized directive attributes

I am currently working on a custom directive that will activate a specified event when a particular expression evaluates as true. The code below demonstrates how it can be achieved when binding a single value- <div ng-trigger="value.someBoolean" /> ...

Creating an engaging Uikit modal in Joomla to captivate your audience

I need help optimizing my modal setup. Currently, I have a modal that displays articles using an iframe, but there is some lag when switching between articles. Here is the JavaScript function I am using: function switchTitleMod1(title,id) { document.g ...

Update the second dropdown automatically based on the selection in the first dropdown menu

I need assistance with creating two dropdown menus that are linked, so when an option is selected in the first menu, it automatically changes the options available in the second menu. Both menus should be visible at all times. I have set up a fiddle to pr ...

What could be causing my form to malfunction when attempting to submit data using Ajax and an external PHP script that is handling two string inputs?

Hello, I am facing an issue while trying to utilize Ajax to interact with a PHP file and submit both inputs (fullname and phonenumber). When I click the submit button, it simply refreshes the page without performing the desired action. Below is the code I ...

Exploring the Power of AJAX Pagination in CakePHP 3

I'm currently working on implementing ajax pagination in cakephp 3. Although I have added a simple jquery code for pagination, I'm aware that this is not the optimal solution. Below is the code that I have experimented with: $('document&apo ...

Tips for verifying the "truthiness" of an object, removing any falsy values, and making changes to the object

I am faced with the task of examining each property of an object to determine if it is truthy, and then removing any that are not. var user = { name: 'my name', email: null, pwHash: 'U+Ldlngx2BYQk', birthday: undefined, username: &ap ...

Exploring the efficiency of AngularJS when binding to deeply nested object properties

Are there any performance differences to consider when data binding in Angularjs between the following: <div>{{bar}}</div> and <div>{{foo.bar}}</div>? What about <div>{{foo.bar.baz.qux}}</div>? Our team is working o ...

The URL provided for the Ajax HTTP request is not accurate

Consider the following JavaScript code: <script type="text/javascript" charset="utf-8> function goForLogin() { var xmlhttp; xmlhttp=new XMLHttpRequest(); xmlhttp.open("POST","/account/login",true); xmlhttp.s ...

Issue with jQuery validation plugin is that the select element is not being properly validated

The jQuery validation plugin I'm using (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) is functioning properly on most elements, but there are 2 select boxes where it's not working. You can see an example of one of these problema ...

Manipulating Vue.js data within HREF attributes using PHP

Does anyone know how to successfully pass the data from Vue into PHP? I've attempted a few methods, but when I try to use the resulting link in the href attribute (href = $ where $ name), it shows a strange string instead of the expected URL from the ...

What is the best way to download the entire page source, rather than just a portion of it

I am currently facing an issue while scraping dynamic data from a website. The PageSource I obtain using the get() method seems to be incomplete, unlike when viewing directly from Chrome or Firefox browsers. I am seeking a solution that will allow me to fu ...

Performing an AJAX request to retrieve the data from a textarea inside a modal window once the Document Object Model is fully loaded

I'm currently working with Messi for modal windows. I have added a text area to the modal window, but I am facing an issue in accessing the value entered in it since the DOM has already been loaded. Here is my existing code snippet: new Messi ...

What is the best method to redirect users who are not logged in from every URL when using PassportJs?

I am currently developing a web application using NodeJS, and I have integrated PassportJS with passport-local-mongoose for authentication. Below is the code snippet I've created for the root route to verify if the user is logged in: app.get('/ ...

What are the advantages of utilizing NGRX over constructor-injected services?

Have you ever wondered about the benefits of using NGRX or NGXS for an Angular application instead of constructor injected services to manage component IO? Is it simply to prevent mutation of component properties references without replacing the entire pr ...