我试图通过ajax简写方法提取一些json数据。通过文本键盘调用,它工作正常,但在按钮提交调用时失败。请有人帮忙。
$(document).ready(function(){
$('#emcode').keyup(function(){
var length=$('#emcode').val().length;
if (length > 4){
var emcodeValue=$('#emcode').val();
$.post('jason.php',{emcode: emcodeValue},function(result){
$('#feedback').html(result).show();
});
};
});
});
$('#data-submit').click(function(){
var length=$('#emcode').val().length;
if (length > 4){
var emcodeValue=$('#emcode').val();
$.post('jason.php',{emcode: emcodeValue},function(result){
$('#feedback').html(result).show();
});
};
});