2014-12-12 2 views
0

나는 스크립트를했지만 나는 심지어 발견 된 큰 문제는 내가 여러 번 다시 JQuery와의 호출이 응답하지 않았다 : 여기jquery 콜백이 응답하지 않습니까?

HTML 코드

 <h2 class="form_new_project-heading">Please Add Your Information</h2> 
    <label for="project_URL" class="sr-only">project url</label> 
    <input type="text" id="project_URL" class="form-control" placeholder="url- http://www.host.com/folder/" data-validation="url" required="" autofocus=""> 
    <label for="callback" class="sr-only">callback</label> 
    <input type="text" id="callback" class="form-control" placeholder="callback url- http://www.host.com/folder/callpack.html" required=""> 
    <button class="btn btn-lg btn-primary btn-block" id="registernewapp" type="submit">add new project</button> 

여기 JQuery와 스크립트를 페이지

<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.1.47/jquery.form-validator.min.js"></script> 
<script> 
    $('#registernewapp').click(function(){ 
    var a_data=$('#project_URL').val(); 
    var b_data=$('#callback').val(); 
    $.ajax({ 
     type:"POST", 
     data:{server:a_data,back:b_data} 
     url:"http://localhost/", 
     success: function(msg) { 
     alert(Data); 
     } 
     }); 
}); 

의 끝에 코드

url:"http://localhost/", 

그래서, 페이지 또는 PHP 파일을 참조로 변경이 유효한 자원을 참조하지 않을 가능성이

:

<script src="http://localhost/ajax/jquery-1.9.0.min.js"></script> 
+0

http : // localhost/이것은 무엇입니까? 변수를 어디에 전달하려고합니까? 그것을 파일에 전달해야합니다. 파일 경로는 어디에 있습니까? http : // localhost/그 파일이 아닙니다. –

+0

예 제가 알고 있고 실제로 연결될 수 있습니다 http : //lovalhost/ajax/trojan/vip.php? add = newserver –

답변

0

코드를 잘못 여러 가지가있다 또는 뭔가. 당신은 사용자가하지 않은 (이름 콜백 함수를 지정시키는 것, 특히 이후

 success: function(msg) { 
     alert(msg); 
    } 

을하지만 결국 당신은 성공의 함수로 더 많은 작업을 수행 할 수 있습니다 :

이 같은 성공의 기능을 변경

보통 좋은 생각, btw).

+0

대단히 감사합니다. –

관련 문제