jquery AJAX的成功在Firefox中无法使用(只有在这个脚本中其他的效果很好)(Jquery AJAX success doesn't work in Firefox (only

编程入门 行业动态 更新时间:2024-10-13 04:20:51
jquery AJAX的成功在Firefox中无法使用(只有在这个脚本中其他的效果很好)(Jquery AJAX success doesn't work in Firefox (only in this script other works well))

我有4个脚本与Ajax,但其中之一不适用于Firefox。 它提出了一个成功的警示,它也不起作用。 我没有错误信息,但没有发生。 它在IE和Chrome中运行得非常好。

在这里我的代码:

/* Latest compiled and minified JavaScript included as External Resource */ $.ajax( { type: "GET", url: "../processeur.php", dataType: "json", data: dataString, cache:false, success: function(response) { alert("success"); var options =""; if(response != null) { for(var i=0; i<response.data.length; i++) { options +="<option value = '"+response.data[i]+"'>"+response.data[i];"</option>"; } } $("#Liberation tbody").append ( "<tr>"+ "<td align='center'><input class='liberationL' name='liberationL' type='text'/></td>"+ "<td align='center'><input class='serviceL' name='serviceL' type='text'/></td>"+ //liste déroulante des codes projets destinataires "<td align='center'>"+"<select class='codest' name ='codest' id=listecodes >"+"<option>Aucun</option>"+options+"</select>"+"</td>"+ //"<td align='center'><input class='dateL' name='dateL' type='text'/><span><br>jj-mm-AAAA</span></td>"+ "<td align='center'><input type='text' class='dateL' id='DateF' name='dateL' onclick='javascript:onCalendar_click();'/></td>"+ "<td align='center'><input class='montantL' name='montantL' type='text'/></td>"+ //liste déroulante des types de mouvements "<td align='center'>"+"<select class='mouvementL' name='mouvementL'>"+"<option value='lc'>LC(-)</option>"+"<option value='vc'>VC(+)</option>"+"<option value='ci'>CI</option>"+"</select>"+"</td>"+ "<td align='center'>"+ "<img src='../images/enregistrer.png' class='btnEnregistrerLiberation'"+"style='cursor: pointer;'/>"+' '+"<img src='../images/supprimer.png' class='btnSuppLiberation'"+"style='cursor: pointer;'/>"+"</td>"+ "</tr>" ); $(".btnEnregistrerLiberation").bind("click", EnregistrerLiberation); $(".btnSuppLiberation").bind("click", SupprimerLib); }, failure: function() { alert("error"); } });

在这里我的php代码,其中数据用json_encode进行编码:

include './BD/T_mouvements.php'; include '../sql.php'; require './jsonwrapper/jsonwrapper.php'; $idProg = $_GET['idProg']; $exercice = $_GET['exercice']; $array = array(); $liste = selectionnerListePro($exercice, $idProg); echo json_encode(array('data'=>$liste)); exit();

I've 4 script with ajax but one of them doesn't works in Firefox. It put an alert in success & it dosen't work too. I've no error message but nothing happen. It works very well in IE & Chrome.

Here my code :

/* Latest compiled and minified JavaScript included as External Resource */ $.ajax( { type: "GET", url: "../processeur.php", dataType: "json", data: dataString, cache:false, success: function(response) { alert("success"); var options =""; if(response != null) { for(var i=0; i<response.data.length; i++) { options +="<option value = '"+response.data[i]+"'>"+response.data[i];"</option>"; } } $("#Liberation tbody").append ( "<tr>"+ "<td align='center'><input class='liberationL' name='liberationL' type='text'/></td>"+ "<td align='center'><input class='serviceL' name='serviceL' type='text'/></td>"+ //liste déroulante des codes projets destinataires "<td align='center'>"+"<select class='codest' name ='codest' id=listecodes >"+"<option>Aucun</option>"+options+"</select>"+"</td>"+ //"<td align='center'><input class='dateL' name='dateL' type='text'/><span><br>jj-mm-AAAA</span></td>"+ "<td align='center'><input type='text' class='dateL' id='DateF' name='dateL' onclick='javascript:onCalendar_click();'/></td>"+ "<td align='center'><input class='montantL' name='montantL' type='text'/></td>"+ //liste déroulante des types de mouvements "<td align='center'>"+"<select class='mouvementL' name='mouvementL'>"+"<option value='lc'>LC(-)</option>"+"<option value='vc'>VC(+)</option>"+"<option value='ci'>CI</option>"+"</select>"+"</td>"+ "<td align='center'>"+ "<img src='../images/enregistrer.png' class='btnEnregistrerLiberation'"+"style='cursor: pointer;'/>"+' '+"<img src='../images/supprimer.png' class='btnSuppLiberation'"+"style='cursor: pointer;'/>"+"</td>"+ "</tr>" ); $(".btnEnregistrerLiberation").bind("click", EnregistrerLiberation); $(".btnSuppLiberation").bind("click", SupprimerLib); }, failure: function() { alert("error"); } });

Here my php code, where data is encoded with json_encode :

include './BD/T_mouvements.php'; include '../sql.php'; require './jsonwrapper/jsonwrapper.php'; $idProg = $_GET['idProg']; $exercice = $_GET['exercice']; $array = array(); $liste = selectionnerListePro($exercice, $idProg); echo json_encode(array('data'=>$liste)); exit();

最满意答案

好的,我发现我的问题。 实际上,我的代码很好,但是错误在我的sql.php中

在我之前编码的人,忘记了“;”......

谢谢大家 :)

Ok, I found my problem. In fact, my code was good but the bug was in my sql.php

The guy who coding before me, forget a ";"...

Thanks everybody :)

更多推荐

本文发布于:2023-08-07 16:20:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465357.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:在这个   其他的   脚本   效果很好   Firefox

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!