如何检查是否isset HTTP Get方法在JavaScript或JQuery?
我们在一个有以下url的页面:
https://example.com/blog?page=2
和我想检查是否issetGet method
:
<script>
if (isset(method.get)){
// yes is set
}
</script>
我该怎么办?
try this:
const Get = new Proxy (new URLSearchParams (window.location.search), {
get: (searchParams, prop) => searchParams.get (prop),
});
if (Get.page){ // page is the ?page=3
// yes is set
}