English 中文(简体)
利用Jquery改造现有的URL
原标题:Getting current URL using Jquery
  • 时间:2009-11-26 10:45:12
  •  标签:
  • jquery
  • ajax

我在javascript和jquery中非常新。

$.getJSON("idcheck.php?callback=?", { url:  /*i want full url to be print*/ }, function(json){
  //alert(json.message);
});

• 如何在午餐后一页上接手全程?

谢谢。

最佳回答
问题回答

您应使用<条码>window. place.pathname 或window. place

通过Jquery和Javascript接手RURL网页

  $(document).ready(function() {
      //jquery
    $(location).attr( href );

    //pure javascript
    var pathname = window.location.pathname;

    // to show it in an alert window
    alert(window.location);
});


$.getJSON("idcheck.php?callback=?", { url:$(location).attr( href )}, function(json){
  //alert(json.message);
});

你们可以这样做:

var path = window.location.pathname; // path only
var url      = window.location.href;     // full URL

Edit:

$.getJSON("idcheck.php?callback=?", { url: window.location.href }, function(json){ alert(json.message);});




相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Virtual Tour using sketch up, ajax, flash technologies

I want to know if there are existing technology that make your 3d models in sketch into virtual tours, using either Ajax or Flash for web presentation. If there s none, which will be a good approach ...

How can i update div continuously

I have asp.net application where i have a div which showing the value from other site. The value of that site is changing continuously. I want that my div will automatically update in some interval ...

热门标签