-2

I have a problem with a local file, I don't know if it's possible but I like to know if its...

My code in my local HTML is:

$(document).ready(function(){
$("#load").load("http://localhost/prueba.php",{estado:"ok"});});

And the php online is:

<?php
echo '<script>alert("' . $_POST["estado"] . '");</script>';?>

If I run my local HTML like "http:// localhost /prueba.htm" runs fine! But if I try to run my local file like "C:\documents\prueba.htm" not run the php code and that is what I need.

This is only an example, really I want to run a query in php and get me back my info to my HTML file.

Can anyone help me? Sorry by my english its bad but I've no more options... any idea how to do it?

  • 1
    I don't believe that .load() will post the data. Try $_REQUEST instead of $_POST. Is it returning any data at all? – JRL Apr 17 '13 at 22:26

2 Answers2

1

The main problem is that your request will not be allowed because of the browser's Same Origin Policy. Please have a look at jQuery Ajax request from local filesystem (Windows file:///)

Community
  • 1
  • 1
plalx
  • 42,889
  • 6
  • 74
  • 90
0

Where did you place php code?

Make sure you put it in same folder.

user2279205
  • 175
  • 9