5582 次
2 に答える
0
で作成でき.keyup()
ます。たとえば、各入力にクラスを追加するだけです
<input type="text" class="coil_input" maxlength="7" size="7" name="coil_id" value="coil_11">
<input type="text" class="coil_input" maxlength="7" size="7" name="coil_id" value="coil_22">
<script>
$('.coil_input').keydown(function() {
if($.trim($(this).val()).length == 7){
var now_input_value = $(this).val();
$.post('file.php', {now_input: now_input_value}, function(){ alert('Data sent'); }).fail(function(){ alert('An error has ocurred'); });
}
});
</script>
すべての入力は同じクラスでなければなりません
ドキュメントに jQuery を忘れずに追加してください。
于 2013-04-26T17:52:59.093 に答える
0
here is example of jquery ajax. serialize will create generate query string that will be sent to your url.
var datastring = $("#yourForm").serialize();
$.ajax({
type: "POST",
url: "your url",
data: datastring,
dataType: "json",
success: function(data) { alert('all ok');}
});
于 2013-04-26T17:54:08.883 に答える