To pass JavaScript variables with AJAX calls, replace the following −
var page = parseInt(getUrlParameter('page'));With −
var page = +getUrlParameter("page") || 100;Example
Try the following code to correctly pass variables with AJAX calls −
Live Demo
<html>
<script>
function getUrlParameter ( param ) {
return param === "page" ? 500 : false;
}
var page = +getUrlParameter("Demo") || 100;
alert(page);
page = +getUrlParameter("page") || 100;
alert(page);
</script>
<body>
</body>
</html>