2012-04-14 3 views
0

이 Ajax 요청은 작동하지만 인수가 getHint.php ($_POST['targetId']이 비어 있음)에 게시되지 않은 것처럼 보입니다. 내가 뭘 잘못하고 있는거야?인수가 Ajax 요청과 함께 게시되지 않았습니다.

많은 감사

postAjaxRequestFunktion(minFunktion, 'getHint.php', 'targetId = ' + playId) 

     function postAjaxRequestFunktion(minFunk,minUrl, mittArg) 
     { 
      var contenttype = 'application/x-www-form-urlencoded' 
      var minRequest  = new skapaAjaxObjekt(minFunk) 
      if (!minRequest) return false 
      minRequest.open('POST', minUrl, true) 
      minRequest.setRequestHeader('Content-type', contenttype) 
      minRequest.setRequestHeader('Content-length', mittArg.length) 
      minRequest.setRequestHeader('Connection',  'close') 
      minRequest.send(mittArg) 
      return true 
     } 


     function skapaAjaxObjekt(minFunk) 
     { 
      try  { var minRequest = new XMLHttpRequest()     } 
      catch(e1) { try { minRequest = new ActiveXObject("Msxml2.XMLHTTP") } 
      catch(e2) { try { minRequest = new ActiveXObject("Microsoft.XMLHTTP") } 
      catch(e3) { minRequest = false }}} 
      if (minRequest) minRequest.onreadystatechange = function() 
      { 
       if (this.readyState == 4 && this.status == 200 && 
        this.responseText != null) 
        minFunk.call(this.responseText) 
      } 

      return minRequest 
     } 

     function minFunktion() 
     { 
      hintArray = eval('(' + this + ')');  
     } 

getHint.php :

$targetId = $_POST['targetId']; 
+0

HTML을 보여 주시겠습니까? – Lion

+0

나는 당신이 볼 필요가있는 HTML이 무엇인지 모르겠습니다. – Fred

답변

1

내가 조언은 당신이 (또한 PHP 파일을 사용 위해서 var_dump에서 아약스 요청이 더 간단됩니다 JS lib에 jQuery를 .. 를 사용하는 $ _POST); 더 많은 정보를 얻을 수 있습니다

+0

jQuery가 훨씬 쉽습니다. – Fred

관련 문제