I have the following function in a .js file in index.html
function getValues(){
$.ajax({
type: \'POST\',
url: \"http://localhost/getData/getdata.php\
When you run your index.html from a file the AJAX works. But the problem occurs because you are viewing the file at address "file://....../index.html" and you are making a AJAX request to "http://localhost/..../something.php" which IS NOT ALLOWED because of cross site scripting. All AJAX requests must go to the same domain/server.
This is a assuming that you are viewing the file by double clicking it and still making the AJAX request to the web server.