get URL Query params with jquery & js

// Assuming “?order=1&total=30”

While URLSearchParams is ideal, not all browsers support that API. There’s a polyfill available but if you want a tiny function for basic query string parsing, the following is a function stolen from the A-Frame VR toolkit which parses the query string to get the key’s value you’d like:

function getUrlParameter(name) {
    name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
    var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
    var results = regex.exec(;
    return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));

With the function above, you can get individual parameter values:

getUrlParameter('order'); // "1"

Javascript: Audio play() Method

<!DOCTYPE html>

<audio id="myAudio">
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
  Your browser does not support the audio element.

<p>Click the buttons to play or pause the audio.</p>

<button onclick="playAudio()" type="button">Play Audio</button>
<button onclick="pauseAudio()" type="button">Pause Audio</button> 

var x = document.getElementById("myAudio"); 

function playAudio() {; 

function pauseAudio() {