2013-10-02 2 views
0

사용자가 입력 한 이메일 주소와 함께 URL을 추가 한 다음 버튼을 통해이 이메일 주소를 제출하려면 어떻게합니까? 나는 팝업 될 모달을 사용하고 이메일을 요구 한 다음 사용자가 제출 버튼을 눌렀을 때 url을 호출한다. (jQuery가 지원됩니다) 어떤 도움을 많이 주시면 감사하겠습니다! 감사합니다입력에서 매개 변수 전달하기

<div id="emailModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> 
       <div class="modal-header"> 
       <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> 
       <h3 id="myModalLabel"> We Can Help</h3> 
       </div> 
       <div class="modal-body"> 

       <h6> Enter your information in the fields below to reset a forgotten password, or to restore access to an account that has been locked for security </h6> 
       <br> 
       <form > 

        <input type="text" class="input-block-level" placeholder="Email address"> 
        <!-- <input type="password" class="input-block-level" placeholder="Password"> 
        <label class="checkbox"> 
         <a href="#"><input type="checkbox" value="remember-me"> Remember me 
        </label></a> --> 

        </form> 
       </div> 
       <div class="modal-footer"> 

       <button class="m-btn blue" data-dismiss="modal">Submit</button> 
       </div> 
      </div> 
+0

버튼의 클릭하면 쉽게 양식의'의회 처리 속성을 업데이트 할 수 있으며 그렇게 데이터를 제출하십시오. 이것을위한 아약스에 대한 필요가 없습니다. – Archer

+0

그러면 어떻게 URL에 이메일을 추가하겠습니까? – Mac10

+0

답변을 추가했습니다. 아약스를 사용하고 싶다면 @agrothe의 답변이 있습니다. – Archer

답변

1

변경이 폼 ...

<form action="some-url.php" method="get"> 
    <input type="text" name="email" class="input-block-level" placeholder="Email address"> 
</form> 

이 스크립트를 추가 ...

$("#emailModal button").on("click", function() { 
    $("#emailModal form").submit(); 
}); 
2

내가이 당신이 후에 어떤 생각

$("#emailModal .m-btn").click(function(){ 
    $.post("/my/url?email=" + $("#emailModal input.input-block-level").val(), function(){ 
     // this function is called on POST finish. 
    }); 
    return false; 
}); 

과 같은 작업을 수행 할 수 있습니다.

관련 문제