Here is the AJAX method that works in Safari, but not in Chrome. Error message follows.
$(document).ready(function(){
$('.infobutton').click(function(){
$.ajax({
url: 'http://apps.nlm.nih.gov/medlineplus/services/mpconnect_service.cfm',
data: {
'mainSearchCriteria.v.cs': $(this).attr('data-code-system'),
'mainSearchCriteria.v.c': $(this).attr('data-code')
},
dataType: 'xml',
async: false,
method: 'GET',
success: function(data){
console.log('success');
console.log(data);
},
done: function(data){
console.log('done');
console.log(data);
},
error: function(data){
console.log('error');
console.log(data.error());
}
});
});
});
The console output gives the statusText in the error callback as this: "Error: NetworkError: DOM Exception 19". This link talks about DOM Exception 19, but that just says NETWORK ERROR. Not helpful.
I know from other research that Chrome has known issues with security, XSS, etc.
I've tried every suggestion in this SO post, as well as this one. No luck.
Going directly to the URL with that query string works. You can view it here.
Also notice that this isn't part of an application. The html is literally just <button class="infobutton">Click Me</button>. This is just a proof of concept to get the AJAX working.
UPDATE
I can also confirm that I get this same error both locally (using the file:/// protocol), and remotely, working on a dev server.