2012-11-08 3 views
0

조금 잃어 버렸습니다 ... 사이트에 AJAX 호출이 많이 있습니다. JavaScript 텍스트 필드 서식을 사용하여 시도했지만 처리하기가 너무 어려웠으므로이 태그 없이는 정상으로 돌아 가기로 결정했습니다. 하지만 내 아약스 호출 지금 아무도가 작동하지 않습니다 내가 왜 몰라 ... 내가 가진 모든이 오류입니다 :ReferenceError : ajaxCall이 정의되어 있지 않습니다.

ReferenceError: name-of-the-call is not defined 

호출은 "scripts.js"파일에 위치하며이 포함되어 있습니다 헤더에서 시작부터.

이것은 입력란 사이에 업로드 스크립트와 화살표 키 네비게이션이있는 지금 내 헤더입니다.

<head> 
<title>The title</title> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<link rel="stylesheet" type="text/css" href="style.css" /> 
<link rel="stylesheet" type="text/css" href="/scripts/uploadify.css"> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
<script type="text/javascript" src="/scripts/jquery.uploadify.min.js"></script> 
<script type="text/javascript" src="scripts.js"></script> 
<script type="text/javascript" src="/scripts/ajaxsubmit.js"></script> 
    <script type="text/javascript"> 
     <?php $timestamp = time();?> 
     $(function() { 
      $('#file_upload').uploadify({ 
       'formData'  : { 
        'timestamp' : '<?php echo $timestamp;?>', 
        'token'  : '<?php echo md5('unique_salt' . $timestamp);?>' 
       }, 
       'height' : 25, 
       'buttonText' : 'bla bla...', 
       'onUploadSuccess' : function(file, data, response) { 
        document.getElementById("uploadedId").innerHTML+='<p style="margin: 0px;"><img width="25px" src="/img/success.png" /><b>' + data + '</b></p>'; 
        var str = document.getElementById("uploadedFiles").value; 
        if(str == ""){ 
         document.getElementById("uploadedFiles").value=data; 
        }else{ 
         document.getElementById("uploadedFiles").value+=',' + data; 
        } 
       }, 
       'swf'  : '/scripts/uploadify.swf', 
       'uploader' : '/scripts/uploadify.php' 
      }); 
     }); 
    </script> 
    <script type="text/javascript"> 
     $(document).ready(function(){ 
      $('body').on('keyup', 'input', function(e){ 
       if(e.which==39) 
        $(this).closest('td').next().find('input').focus(); 
       else if(e.which==37) 
        $(this).closest('td').prev().find('input').focus(); 
       else if(e.which==40) 
        $(this).closest('tr').next().find('td:eq('+$(this).closest('td').index()+')').find('input').focus(); 
       else if(e.which==38) 
        $(this).closest('tr').prev().find('td:eq('+$(this).closest('td').index()+')').find('input').focus(); 
      }); 
     }); 
    </script> 
</head> 

이것은 JS 코드 (그들 중 하나, 그들 중 누구도 fowrking 없기 때문에 ...) (이것은 scripts.js에) 일을 무엇을 원하지 않는 것입니다 :

function companyVatnr(str){ 

if (str.length==0) 
    { 
    document.getElementById("companysearch").innerHTML=""; 
    document.getElementById("companysearch").style.border="0px"; 
    return; 
    } 
if(str.length>7){ 
if (window.XMLHttpRequest) 
    {// code for IE7+, Firefox, Chrome, Opera, Safari 
    xmlhttp=new XMLHttpRequest(); 
    } 
else 
    {// code for IE6, IE5 
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
xmlhttp.onreadystatechange=function() 
    { 
    if (xmlhttp.readyState==4 && xmlhttp.status==200) 
    { 
    document.getElementById("companysearch").innerHTML=xmlhttp.responseText; 
    document.getElementById("companysearch").style.border="1px solid #A5ACB2"; 
    } 
    } 
xmlhttp.open("GET","ajaxcompany.php?q="+str,true); 
xmlhttp.send(); 
} 
} 

누군가 나를 도울 수 있습니까? 여기서 어떤 문제가 될 수 있습니까?

대단히 감사합니다!

+0

그것은 약간의 구문 오류가 있어야한다고 생각하지만 그것을 찾을 수 없습니다 ... – VORiAND

+0

그래서 jquery를 사용하고 jquery의 ajax 함수를 사용하지 마십시오 ..... 이상합니다. – zerkms

+0

uploadify 파일에 jQuery를 사용합니다. 업로드 스크립트,하지만 아약스 전화를하지 마십시오. 지금까지 괜찮 았어 ... – VORiAND

답변

0

scripts.js에 구문 오류가있어서 모든 기능이 작동하지 않습니다. 그것을 고친 후에, 모든 것이 정상으로 돌아갔습니다.

관련 문제