English 中文(简体)
• 如何将返回第html页与j Query.get()相平
原标题:how to parse returned page html with jQuery.get()
  • 时间:2011-09-07 08:53:50
  •  标签:
  • jquery

直到最近,我才使用<代码>$.load(),以获得另一页的具体内容,并将其上载到目前的网页上,但当用户提出这些要求时,我发现自己需要一种办法,阻止他们点击的用户打破我的网页。

这导致我阅读了$>get(),该编码发挥了巨大作用,如果在第一次返回之前提出另一项请求,则请允许我放弃这一请求,但现在我需要把所回来的html(它有一个整页的有墨式和头部元素)同起来,并且只从中提取一部分。

我如何做到这一点?

最佳回答

这一工作应当:

$.get( ajax/test.html , function(data) {
    var my_div = $( #my_div , $(data));
});
问题回答

反馈:

function(data) {
     // we wrap data with jQuery here:
     $(data).find("#id");
}

我尝试过各种例子,但返回了物体:客观,稍作修改:

$.get($(this).attr("href"), function(returnedHTML) {
     alert($( #content , $(returnedHTML)).html());
})




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签