2013-08-30 4 views
0

그래서 난 그냥 파일 이름 예 넣을 때 잘 작동 아약스 요청했다 :URL에서 아약스 전화를 얻기

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 기능이 어디 그렇게에서 recheable 만들고 싶어을 나는라는 이름의 URL을 havean 내가 그것을 작동

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){ 

      } 
     }); 
     }); 
}; 
+1

** 동일한 출처 정책을 살펴보십시오 ** - 콘솔에 출처에 대한 오류가 표시됩니다. – tymeJV

+1

도메인 간 요청을 할 수 없습니다. 대신 어떤 종류의 패딩 된 아약스를 사용해야합니다. –

+0

다른 도메인에서 AJAX 데이터를 가져 오는 가장 쉬운 방법은 [거의 * 나타납니다] [JSON-P] (http://stackoverflow.com/questions/2067472/what-is-jsonp-all-about)를 사용하는 것입니다. 이미 사용하고 있습니다. – Blazemonger

답변

0

func.php 페이지 헤더에 이러한 추가 정지 그렇게 할 때 내가 thisbut처럼 연결 시도 cligit.com

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

호프가 도움이 되었기를 바랍니다.