VANHIEP.NET - Làm web giá rẻ - Thiết Kế Website - Thiết Kế Ứng Dụng Mobile

Thao tác với đường link trên trình duyệt trong JQuery

Thao tác với đường link trên trình duyệt trong JQuery

1. Lấy dữ liệu từ params trên đường link

const url               = new URL(window.location.href);
        let user_id             = url.searchParams.get("user_id");
        let channel             = url.searchParams.get("channel");
        let game_type           = url.searchParams.get("game_type");
        let date_start          = url.searchParams.get("date_start");
        let date_end            = url.searchParams.get("date_end");
        let date                = url.searchParams.get("date");
        let status              = url.searchParams.get("status");
        let limit               = url.searchParams.get("limit");

2. Push dữ liệu lên đường link

 var link = url.origin + '/admin/game/gift' + string;
        window.history.pushState('', document.title, link);

url.origin : là hàm lấy đường dẫn có dạng https://domain.com