aboutsummaryrefslogtreecommitdiff
path: root/files/ko/web/api/urlsearchparams/tostring/index.html
blob: 45f0373decac36bff9f8ebd93df288a8cdcad7e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: URLSearchParams.toString()
slug: Web/API/URLSearchParams/toString
translation_of: Web/API/URLSearchParams/toString
---
<p>{{ApiRef("URL API")}}</p>

<p><strong><code>toString()</code> </strong>{{domxref("URLSearchParams")}} 인터페이스의 메소드로서, URL에서 사용할 수 있는 쿼리 문자열을 리턴합니다.</p>

<div class="blockIndicator note">
<p><strong>Note</strong>: 이 메소드는 물음표가 없는 쿼리 문자열을 리턴합니다. 이는 물음표를 포함하여 리턴하는 <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/search">window.location.search</a>와는 다른 부분입니다.</p>
</div>

<p>{{availableinworkers}}</p>

<h2 id="Syntax">Syntax</h2>

<pre class="syntaxbox">URLSearchParams.toString()</pre>

<h3 id="Parameters">Parameters</h3>

<p>None.</p>

<h3 id="Return_value">Return value</h3>

<p>A {{domxref("DOMString")}}, without the question mark.</p>

<h2 id="Examples">Examples</h2>

<pre class="brush: js">let url = new URL('https://example.com?foo=1&amp;bar=2');
let params = new URLSearchParams(url.search.slice(1));

//두번째 foo 파라미터를 추가합니다.
params.append('foo', 4);
console.log(params.toString());
//'foo=1&amp;bar=2&amp;foo=4'를 출력합니다.

// note: params can also be directly created
let url = new URL('https://example.com?foo=1&amp;bar=2');
let params = url.searchParams;

// or even simpler
let params = new URLSearchParams('foo=1&amp;bar=2');
</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('URL', '#interface-urlsearchparams', "toString() (see \"stringifier\")")}}</td>
   <td>{{Spec2('URL')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<div>


<p>{{Compat("api.URLSearchParams.toString")}}</p>
</div>

<h2 id="See_also">See also</h2>

<ul>
 <li>The {{domxref("URL")}} interface.</li>
 <li><a href="https://developers.google.com/web/updates/2016/01/urlsearchparams?hl=en">Google Developers: Easy URL manipulation with URLSearchParams</a></li>
</ul>