0

したがって、ファイル名をexにするだけで正常に機能するajaxリクエストがあります。

var security = function(){
    var link = $('#chosen').attr('href');
        $.get('func.php',function(result)         {
            if (result > 75 && result % 5 === 0){
                    $('#chosen').attr("href", link);


            }else{
             $('#chosen').attr('href','https://www.google.com');

            }
        });
        $("#chosen").click(function(){
            $.get('func2.php',function(results){
            if (results === results){
                location.reload();
            }
        });
        });
        $("#chosen").click(function(){
            $.get('func3.php',function(results){
            if (results === results){

            }
        });
        });
};

func.php関数をどこからでも再利用できるようにしたいので、cligit.comという名前のURLがあります。このようにリンクしようとしましたが、そうすると動作しなくなります

var security = function(){
    var link = $('#chosen').attr('href');
        $.get('http://www.vanillacomp.com/browse/func.php?callback=?func.php',function(result)         {
            if (result > 75 && result % 5 === 0){
                    $('#chosen').attr("href", link);


            }else{
             $('#chosen').attr('href','https://www.google.com');

            }
        });
        $("#chosen").click(function(){
            $.get('http://www.cligit.com/func2.php',function(results){
            if (results === results){
                location.reload();
            }
        });
        });
        $("#chosen").click(function(){
            $.get('http://www.cligit.com/func3.php',function(results){
            if (results === results){

            }
        });
        });
};
4

1 に答える 1

0

func.phpこれらをページのヘッダーに追加します

header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST');

これが役に立てば幸いです、ありがとう

于 2013-08-30T17:06:18.490 に答える