jQuery $.ajax(), $.post sending “OPTIONS” as REQUEST_METHOD in Firefox

前端 未结 23 2765
傲寒
傲寒 2020-11-22 14:38

Having trouble with what I thought was a relatively simple jQuery plugin...

The plugin should fetch data from a php script via ajax to add options to a

23条回答
  •  一个人的身影
    2020-11-22 15:29

    I seems that if o.url = 'index.php' and this file exists is ok and returning a success message in the console. It returns an error if I use url:http://www.google.com

    If doing a post request why not using directly the $.post method:

    $.post("test.php", { func: "getNameAndTime" },
        function(data){
            alert(data.name); // John
            console.log(data.time); //  2pm
        }, "json");
    

    It is so much simpler.

提交回复
热议问题