javascript - jQuery post and get not returning anything, despite the network request is being sent succesfully -


i have following javascript function:

function test() {  jquery.post("http://www.example.com/test.php", {})  .done(function(data) {              alert(data);   })  .fail( function(xhr, textstatus, errorthrown) {             console.log(xhr);             console.log(textstatus);             console.log(errorthrown);  }); 

}

and test.php file reads this:

 <? echo "test"; ?> 

when call function either clicking on on page, either typing console, alert not firing, instead fail part of jquery.post being fired, following values:

xhr -> object

textstatus -> "error"

errorthrown -> ""

i've checked firefox debugers network, see request being sent desired url, , little circle @ left side gets green, means kind of response server, transfered column single "-" line, , received column 0 bytes. if call page "http://www.example.com/test.php" browser, works correctly.

what problem, or how proceed on debuging error?

figured out problem, see own answer below, if experiences same error:|

figured out problem. accessing site example.com browser, , not www.example.com send ajax request. ajax handled request cross-domain , that's why didn't answer... dumb me...


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -