Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
const params = new URLSearchParams({ search: "hello world", page: 2, limit: 20 }); const url = `/api/users?${params}`; // /api/users?search=hello+world&page=2&limit=20 const fullUrl = new URL("/api/users", "https://example.com"); fullUrl.searchParams.set("role", "admin"); await fetch(fullUrl.toString());
Result
Open