美好的一天,我需要将过去的变量发布到其他文件
}
$.ajax({
url: 'emps.php',
type: 'POST', // GET or POST
data: {"sucursal":$("#suc").val()},
success: function(data) { // data is the response from your php script
// This function is called if your AJAX query was successful
alert(data);
},
error: function() {
// This callback is called if your AJAX query has failed
alert("Errors!");
}
});
}
代码变量
<tr>
<td class="col1"><label for="pat">Sucursal:</label></td>
<td class="col2">
<input type="text" name="suc" id="suc" class="medium" readonly="true" style="width: 200px;"size="40" maxlength="200" onChange="javascript:this.value=this.value.toUpperCase();" />
<input type="button" class="btn btn-success btn-sm" id="sbm" name="sbm" value="Buscar" onclick="llenaSucursales()" />
</td>
</tr>
错误图片是:
这是一个问题吗?
我等待你的帮助,我开始阅读和搜索,但找不到错误
答案 0 :(得分:2)
你应该看看jQuery documentation for $.ajax(),了解你可以用来对AJAX调用中的错误作出反应:
from __future__ import print_function
from inputs import get_key
from inputs import DeviceManager
def main():
devices = DeviceManager()
dictionaries = devices.codes
qt = False
while qt == False:
events = get_key()
for event in events:
if (event.code in dictionaries["Key"].values() and event.code != "KEY_ESC" and event.state == 1):
print(event.code, event.state)
elif (event.code in dictionaries["Key"].values() and event.code == "KEY_ESC" and event.state == 1):
qt = True
break
return
if __name__ == "__main__":
main()
我还建议打开开发者工具(在大多数浏览器中使用F12)并检查&#34;网络选项卡&#34;查看AJAX调用的响应。
与您的问题无关:
将来请在撰写帖子时多加小心。删除不必要的空行,不要错误地发布代码(只关注你发布的重要部分) - 谢谢。
答案 1 :(得分:0)
错误是我失踪了&#34; /&#34;文件的地址,谢谢,然后我留下代码
function empleados(){
if($("#suc").val()=='')
{
alert('Elige una sucursal');
return false;
}
$.ajax({
url: '/emps.php',
type: 'POST', // GET or POST
data: {"suc":$("#suc").val()},
success: function(data) { // data is the response from your php script
// This function is called if your AJAX query was successful
alert(data);
},
error: function() {
// This callback is called if your AJAX query has failed
alert("Errors!");
}
});
}