本文介绍了如何获取url参数javascript ....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
两页:
index.html / js
other_page.html / js
我需要使用urlparâmeter从other_page获取我的index.html的ID值...
我的尝试:
我试过:
Two pages:
index.html/js
other_page.html/js
I need to get the ID value from my index.html in other_page using the url parâmeter...
What I have tried:
I have tried:
$.urlParam = function(name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
if (results == null) {
return null;
} else {
return results[1] || 0;
}
}
var id_titulo_busca = $.urlParam('id_titulo'); //
if(id_titulo_busca !== 'null'){// //carrega_descricao(id_titulo_busca);//alert(id_titulo_busca);// }
$("pesquisar").click(function() {
console.log( "ready!" );// alert("test");
});
推荐答案
这篇关于如何获取url参数javascript ....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!