jquery和php怎么链接地址,jQuery操作url地址(附代码)

这次给大家带来jQuery操作url地址(附代码),jQuery操作url地址的注意事项有哪些,下面就是实战案例,一起来看一下。

path.makeUrlAbsolute() 把相对URL转化为绝对URLjQuery.mobile.path.makeUrlAbsolute( relUrl, absUrl )

把相对URL转化为绝对URL的方法。这个函数返回一个字符串,绝对URL。

relUrl:相对网址。类型:字符串。

absUrl:绝对网址。类型:字符串。

jQuery.mobile.path.makeUrlAbsolute demo

#myResult{

border: 1px solid;

border-color: #108040;

padding: 10px;

}

The absoulte URL used is http://foo.com/a/b/c/test.html

The result will be displayed here

$(document).ready(function() {

$( ".myButton" ).on( "click", function() {

var absUrl = $.mobile.path.makeUrlAbsolute( $( this ).attr( "value" ), "http://foo.com/a/b/c/test.html" );

$( "#myResult" ).html( absUrl );

})

});

path.get() 确定URL中的目录部分jQuery.mobile.path.get( url )

url:只有一个参数。类型:字符串。

确定URL中的目录部分的实用方法。如果URL没有斜线,URL的一部分被认为是一个文件。这个函数返回一个给定的URL目录部分。

jQuery.mobile.path.get demo

#myResult{

border: 1px solid;

border-color: #108040;

padding: 10px;

}

The result will be displayed here

$(document).ready(function() {

$( ".myButton" ).on( "click", function() {

var dirName = $.mobile.path.get( $( this ).attr( "value" ) );

$( "#myResult" ).html( String( dirName ) );

})

});

相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!

推荐阅读:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值