Caught exception: jQuery UI tabs: fragment id mismatch

everything. I created a simple jQuery / PHP chat program that works pretty well. However, I would like to add a feature such as channels or rooms. Ideally, I would like to use the tabs at the top of the chat to control the room in which the user is located (there will be only 2 of them). I thought it would be a simple task, and I saw something similar earlier, but I continue to receive an uncached exception error when I click on the tabs, and the source does not load correctly. I will post the code for the entire chat system, because I have a feeling that the problem may be in it.

jquery

page = { getChat: function() { $.ajax({ url: 'game_src.php', data: 'mode=getChat', dataType: 'html', cache: false, success: function(res){ $("#chatbox").html(res); } }); } }; $("#submitmsg").click(function(){ var clientmsg = $("#usermsg").val(); $.ajax({ url : 'game_src.php', data: 'mode=chatSubmit&msg=' + encodeURIComponent(clientmsg) }); $("#usermsg").attr("value", ""); return false; }); setInterval(page.getChat, 4000); $("#chatChannel").tabs({ cookie: { expires: 1 }, }); 

chat room

 <?php if($user->data['user_id'] == ANONYMOUS) { } else { ?> <div id="chatChannel"> <ul> <li><a href="#global">Global</a></li> <li><a href="#alli">Alliance</a></li> </ul> </div> <form name="message" action=""> <input name="usermsg" type="text" id="usermsg" size="25" /> <input name="submitmsg" type="submit" id="submitmsg" value="Send" /> </form> <br /> <?php } ?> <div id="chatbox" style="border:1px solid black;background-color: rgba(255,255,255,0.3);height:400px;overflow:auto;"> <div id="global"> <?php $chatMsgs = array(); $limit = time()-86400; $sql = 'SELECT COUNT(chat_id) as count FROM '.CHAT_TABLE.' WHERE chat_channel = 0 AND chat_time > '.$limit; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $count = $row['count']; if($count > 0) { $sql = 'SELECT * FROM '.CHAT_TABLE.' WHERE chat_channel = 0 AND chat_time > '.$limit.' ORDER BY chat_time DESC'; $result = $db->sql_query($sql); while($row = $db->sql_fetchrow($result)) { $chatMsgs[] = array( 'chat_time' => $row['chat_time'], 'chat_msg' => $row['chat_msg'], 'chat_user' => $row['chat_user'], 'chat_channel' => $row['chat_channel'] ); } foreach($chatMsgs as $msg) { $sql = 'SELECT username FROM '.USERS_TABLE.' WHERE user_id = '.$msg['chat_user']; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $username = $row['username']; echo '<div class="chatMsg" style="border-bottom:1px solid black;">'; echo '<div class="chatUsr">'.$username.' says:</div>'; echo '<div class="chatUsrMsg" style="float:left;">'.$msg['chat_msg'].'</div>'; echo '<div class="chatMsgTime" style="float:right;">'.date("g:ia", $msg['chat_time']).'</div>'; echo '</div>'; echo '<br />'; echo '<hr />'; } } else { echo '<div class="chatMsg">Nothing is heard but the sound of crickets...</div>'; } ?> </div> <div id="alli"> <?php $chatMsgs = array(); $limit = time()-86400; $sql = 'SELECT COUNT(chat_id) as count FROM '.CHAT_TABLE.' WHERE chat_channel = 1 AND chat_time > '.$limit; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $count = $row['count']; if($count > 0) { $sql = 'SELECT * FROM '.CHAT_TABLE.' WHERE chat_channel = 1 AND chat_time > '.$limit.' ORDER BY chat_time DESC'; $result = $db->sql_query($sql); while($row = $db->sql_fetchrow($result)) { $chatMsgs[] = array( 'chat_time' => $row['chat_time'], 'chat_msg' => $row['chat_msg'], 'chat_user' => $row['chat_user'], 'chat_channel' => $row['chat_channel'] ); } foreach($chatMsgs as $msg) { $sql = 'SELECT username FROM '.USERS_TABLE.' WHERE user_id = '.$msg['chat_user']; $result = $db->sql_query($sql); $row = $db->sql_fetchrow($result); $username = $row['username']; echo '<div class="chatMsg" style="border-bottom:1px solid black;">'; echo '<div class="chatUsr">'.$username.' says:</div>'; echo '<div class="chatUsrMsg" style="float:left;">'.$msg['chat_msg'].'</div>'; echo '<div class="chatMsgTime" style="float:right;">'.date("g:ia", $msg['chat_time']).'</div>'; echo '</div>'; echo '<br />'; echo '<hr />'; } } else { echo '<div class="chatMsg">Nothing is heard but the sound of crickets...</div>'; } ?> </div> </div> 

I'm going to add a jQuery getChat function parameter to switch back and forth, but with what I have, I'm stuck. Can someone point me in the right direction?

+8
jquery php jquery-ui-tabs
source share
2 answers

The jQuery UI tabs plugin expects the contents of a div be in the same container as the ul links.

In your case, it expects the div content to be in the div id="chatChannel" on the right under ul , but they are not there.

+14
source share

I had this problem when injecting jquery UI tabs into jQuery Mobile app. using

jquery 1.7.2

jquery UI 1.8.2

jQuery Mobile 1.1.

The aparentry problem is the compatibility versions between jQuery UI and jQuery Mobile.

After reading the evry error report and switching between jQuery library versions, I found that the solution was downgraded to jQuery Mobile Legacy version 1.0.1, which did not conflict with the jQuery UI tab component.

Hope jQuery Mobile developers fix this for future versions

-3
source share

All Articles