I am using jquery ajax calls, to send text to the server.
The text (user input), that is sendt to the server, may contain questionmarks. If there is just one questionmark "?" its no problem, but if there are two questionmarks "??" side by side, then the ajax call stops working propperly.
text example:
Is this a text example?? yes it is...
will produce:
Is this a text examplejQuery17205792287601360849_1347644361296 yes it is...
I think the root of this problem is the caching of the ajax call:
cache Default: true, false for dataType 'script' and 'jsonp'
If set to false, it will force requested pages not to be cached by the browser. Setting cache to false also appends a query string parameter, "_=[TIMESTAMP]", to the URL.
Anyhow two ?? side by side in a text string sendt by an jquery ajax call with json makes the query string parameter to show up in the original text instead of the two ??
Now what is the best solution for this?
Can anyone help me write a str.replace function with regex that ensures that there are not two ?? side by side in the textstring...?
Thx!
// text will be stored in the database via ajax call
$.ajax ({
type: "POST",
url: "ajax/ajax_special_functions.php",
data: data_string,
dataType: "json",
success: function(recive_obj) {
// Some more code...
}
});
The text is contained in data_string... If there are two ?? in the text, the ajax call is still fired und the data is transmitted to the server, but the callback function will never get fired...
Update: I have solved this problem temporarely with a regex str replace - If someone discouvers a more clean way to solve this problem, please let me know.