Bug Tracker

Modify

Ticket #5561 (closed bug: invalid)

Opened 4 years ago

Last modified 4 years ago

ajax bug in document.getElementById and $("#ID")

Reported by: newpat Owned by:
Priority: major Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: $() Cc:
Blocking: Blocked by:

Description

var html = $.ajax({

url: serverPage, async: false

}).responseText; if (html){

document.getElementById(objID).innerHTML=html; $("#dialog").dialog('open');

}else{

alert("Error!");

}

The above code can be runned perfectly (objID = "div1"), but the following code cannot update the "objID" div(objID = "#div1")

var html = $.ajax({

url: serverPage, async: false

}).responseText; if (html){

$(objID).innerHTML=html; $("#dialog").dialog('open');

}else{

alert("Error!");

}

Change History

comment:1 Changed 4 years ago by scott.gonzalez

  • Status changed from new to closed
  • Resolution set to invalid

Your code is invalid. There is no innerHTML property on jQuery objects. Use $(objID).html(html).

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.