I am encountering an issue with my jQuery AJAX function which is supposed to save an image path to the database. Below is an example parameter:
var data = {};
data['url'] = "Path%20to%20URL";
Normally, if there is a space or %20, it should be saved as "Path%20to%20URL"
in the database. However, without making any changes to my code, it is now being saved as
"Path+to+URL"
. I'm trying to figure out what could be causing this unexpected behavior.
I attempted to use
str.replaceAll('+', '%20')
in my code just in case the issue was caused by some other function, but unfortunately, it did not resolve the problem.
Below is how my jQuery AJAX function looks like:
$.ajax({
url: `server-url`,
type: 'PUT',
headers: {
//auth keys
'Content-Type': 'application/json'
},
data: JSON.stringify(data),
success: () => {