Jquery ajax update issue with chrome
Jquery ajax update issue with chrome
我有这段代码
<div id="status">content here</div>
<input name="order_data" type="button" value="<?php echo $order;?>" class="besttocart" onclick="gotocart(this);" />
和Javascript
function gotocart(e)
{
var origtext = $('#status').html();
if(getCookie('language').toLowerCase() == 'en'){
$('#status').html('Loading');
}else{
$('#status').html('het laden');
}
$.ajax({
url: 'index.php?route=foo/bar',
type: 'post',
async:false, /*I strongly suspect something here*/
dataType:"json",
success:function(data){
//do stuff
}
});
}
问题出在谷歌浏览器中$('#status').html()
当我查看控制台时,它正在更改为"加载"或"het laden"。但它没有显示在我的页面中,我的状态内容仍然是"此处的内容"。在火狐中工作正常
我想
问题出在以下行上:
getCookie('language'),
因为当我像这样更改代码时,
var origtext = $('#status').html();
var str=getCookie('language');
//changed the code here
if(str && str!='' && str.toLowerCase() == 'en'){
$('#status').html('Loading');
}else{
$('#status').html('het laden');
}
这工作正常。
如果未设置 cookie,函数 getCookie 将返回空白,但 toLowerCase 不会在 Chrome 中解析它。因此错误。
你试过使用
document.getElemetnById("status").innerHTML="SOMETHING";
相关文章:
- Chrome WebKitGetUserMedia
- JQueryhide()不适用于Mozzilla,但适用于Chrome
- javascript with()函数获胜'我不适合歌剧、Chrome或Brave
- Xpath with js and google chrome
- Error with iconUrl for chrome.notifications
- Chrome 和 iPad with querySelectorAll 出现问题
- 关于在 Chrome 中调用 Chrome API 或 Chrome Extensions with Javascrip
- IntelliJ Maven WAR with Chrome Developer Workspaces
- net::ERR CONTENT LENGTH MISMATCH in Chrome with Jboss WildFl
- Chrome Crashing with whitespaces in Textarea on using onClic
- Bug with chrome.tabs.captureVisibleTab
- HTML5/JavaScript File with Canvas不能与windows 8上的Chrome&Firefo
- chrome.browserAction.onClicked.addListener() with popup
- CORS XSL with Chrome
- chrome.notification.create with chrome.notification. onclick
- Jquery mouseenter with live()不能在chrome和浏览器上工作
- canvas setLineDash with array不能在Firefox中工作,但在Chrome中
- window.onload with Chrome
- Jquery ajax update issue with chrome
- Chrome Extension OAUTH with Spotify API