Javascript 在IE和firefox中运行$.ajax的问题
嘿,伙计们,我正在使用chrome,并使用JQuery UI开发了一个窗口开启器,它工作得非常完美。在IE和Firefox中,我注意到它无法工作,我在IE中进行了调试,它说Javascript 在IE和firefox中运行$.ajax的问题,javascript,jquery,jquery-ui,internet-explorer,jquery-ui-dialog,Javascript,Jquery,Jquery Ui,Internet Explorer,Jquery Ui Dialog,嘿,伙计们,我正在使用chrome,并使用JQuery UI开发了一个窗口开启器,它工作得非常完美。在IE和Firefox中,我注意到它无法工作,我在IE中进行了调试,它说 `SCRIPT1028: Expected identifier, string or number` function sendUserfNotes() { $.ajax({ type: "POST", dataType: "json", url
`SCRIPT1028: Expected identifier, string or number`
function sendUserfNotes()
{
$.ajax({
type: "POST",
dataType: "json",
url: '/pcg/popups/getNotes.php',
data:
{
'nameNotes': notes_name.text(),
},<!-- gave me the error right here?
success: function(response) {
$('#notes_msg').text(response.the_notes);
}
});
如果你能帮我一把,我会很感激的:)不确定是什么问题,为什么它只能在Chrome上工作?如果你需要什么,请告诉我
David数据:
{
“名称注释”:注释\u name.text(),
},
这是一个奇怪的问题,但是在
text()
之后删除逗号。这应该会有帮助。它给你的错误实际上就在这里'nameNotes':notes_name.text(),你在Firefox中遇到了什么错误?你的权利在IE中起作用,那么FF呢?使用Firebug或者只打开控制台。为什么你要这样使用setInterval
(只让它触发一次)?你知道设置超时,是吗?
$(document).ready(function () { // this right here will wait to see if the 'access notes is clicked, if so then it will get te value of username and send it to run()
$(".NotesAccessor").click(function () {
notes_name = $(this).parent().parent().find(".user_table");
run();
});
});
function run(){ // defines the place to get the notes, goes to showURL...() to open the JQuery dialog and than senduse....() to display them in the dialog.
var url = '/pcg/popups/grabnotes.php';
showUrlInDialog(url);
sendUserfNotes();
}
function showUrlInDialog(url)
{
var tag = $("#dialog-container");
$.ajax({
url: url,
success: function(data) {
tag.html(data).dialog
({
width: '100%',
modal: true
}).dialog('open');
}
});
}
function sendUserfNotes()
{
$.ajax({
type: "POST",
dataType: "json",
url: '/pcg/popups/getNotes.php',
data:
{
'nameNotes': notes_name.text(),
},
success: function(response) {
$('#notes_msg').text(response.the_notes);
}
});
}
function getNewnotes(){
new_notes = $('#notes_msg').val();
update(new_notes);
}
// if user updates notes
function update(new_notes)
{
$.ajax({
type: "POST",
//dataType: "json",
url: '/pcg/popups/updateNotes.php',
data:
{
'nameNotes': notes_name.text(),
'newNotes': new_notes,
},
success: function(response) {
alert("Notes Updated.");
var i;
$("#dialog-container").effect( 'fade', 500 );
i = setInterval(function(){
$("#dialog-container").dialog( 'close' );
clearInterval(i);
}, 500);
}
});
}
/******is user closes notes ******/
function closeNotes()
{
var i;
$("#dialog-container").effect( 'fade', 500 );
i = setInterval(function(){
$("#dialog-container").dialog( 'close' );
clearInterval(i);
}, 500);
}