I have the following function in a .js file in index.html
function getValues(){ $.ajax({ type: \'POST\', url: \"http://localhost/getData/getdata.php\
You can't do that, you should open your html file also from web server address eg http://localhost/yoursite/file.html or even remote server url. You need to go through the server/server url.
http://localhost/yoursite/file.html