Answers.Body: <p>Use:</p>
  
  <pre><code>{% if craft.request.getQueryString('success') %}
  </code></pre>
  
  <p><a href="https://craftcms.com/docs/templating/craft.request#getQueryString" rel="nofollow">https://craftcms.com/docs/templating/craft.request#getQueryString</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-31T22:09:47.680Z
Answers.LastActivityDate: 2016-03-31T22:09:47.680Z
Answers.UserDisplayName: Brad Bell
Answers.Body: <p>Actually, reading from the <a href="https://docs.craftcms.com/v2/templating/craft.request.html#methods" rel="noreferrer"><strong>Craft 2</strong> docs</a> it's:</p>
  
  <pre><code>craft.request.getQueryString()      // returns the whole query string
  craft.request.getQuery('success')   // returns only the value of 'success'
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-20T06:12:11.763Z
Answers.Text: Thank you, Antoine, that was helpful. And in Craft 3 it seems to now be `craft.app.request.getQueryParam()` otherwise a deprecation error.
Answers.UserDisplayName: kr37
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-22T02:19:04.217Z
Answers.Text: @kr37 Cool! I suggest you turn your comment into a standalone answer, that would be helpful for Craft 3 users. I updated my answer to indicate that it applies to Craft 2.
Answers.UserDisplayName: antoine
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-19T00:56:22.307Z
Answers.LastActivityDate: 2019-01-22T02:17:44.017Z
Answers.LastEditDate: 2019-01-22T02:17:44.017Z
Answers.UserDisplayName: antoine
Answers.Body: <p>As @kr37 pointed out in the comments to another answer, the method for Craft 3, and now 4, is <a href="https://web.archive.org/web/20220518223359/https://docs.craftcms.com/api/v4/craft-web-request.html#method-getqueryparam" rel="nofollow noreferrer"><code>craft.app.request.getQueryParam()</code></a></p>
  <pre><code>{# get $_GET['foo'], if it exists #}
  {% set foo = craft.app.request.getQueryParam('foo') %}
  
  {# get $_GET['foo']['bar'], if it exists #}
  {% set bar = craft.app.request.getQueryParam('foo.bar') %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-11-03T14:44:16.830Z
Answers.LastActivityDate: 2022-11-03T14:44:16.830Z
Answers.UserDisplayName: Jacob
Body: <p>I wrote a PHP script to deploy data to live-cdn and included a "deploy" button on the dashboard. the script returns ?success=true, and i need to show div element with "Congratulations"</p>
  
  <p>i tried this with no success:</p>
  
  <pre><code>{% if app.request.query.get('success') %}
    &lt;div&gt;
      Glückwunsch! Deployment läuft.
    &lt;/div&gt;
  {% endif %}
  </code></pre>
  
Tags: <templating>
Title: How can I get parameters in twig?
ThreadText: # How can I get parameters in twig?
  
  (Asked by: username_0 on 2016-03-31)
  
  I wrote a PHP script to deploy data to live-cdn and included a "deploy" button on the dashboard. the script returns ?success=true, and i need to show div element with "Congratulations"
  
  i tried this with no success:
  
  ```
  {% if app.request.query.get('success') %}
    <div>
      Glückwunsch! Deployment läuft.
    </div>
  {% endif %}
  
  ```
  
  **Tags:** templating
  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2016-03-31. Score: 3 | Accepted answer
  
  Use:
  
  ```
  {% if craft.request.getQueryString('success') %}
  
  ```
  
  <https://craftcms.com/docs/templating/craft.request#getQueryString>
  
  
  ---
  
  ### Answer by username_2 on 2019-01-19. Score: 11
  
  Actually, reading from the [**Craft 2** docs](https://docs.craftcms.com/v2/templating/craft.request.html#methods) it's:
  
  ```
  craft.request.getQueryString()      // returns the whole query string
  craft.request.getQuery('success')   // returns only the value of 'success'
  
  ```
  
  > **Comments:**
  > **username_3**: Thank you, username_2, that was helpful. And in Craft 3 it seems to now be `craft.app.request.getQueryParam()` otherwise a deprecation error.  
  > **username_2**: @username_3 Cool! I suggest you turn your comment into a standalone answer, that would be helpful for Craft 3 users. I updated my answer to indicate that it applies to Craft 2.  
  
  ---
  
  ### Answer by username_4 on 2022-11-03. Score: 3
  
  As @username_3 pointed out in the comments to another answer, the method for Craft 3, and now 4, is [`craft.app.request.getQueryParam()`](https://web.archive.org/web/20220518223359/https://docs.craftcms.com/api/v4/craft-web-request.html#method-getqueryparam)
  
  ```
  {# get $_GET['foo'], if it exists #}
  {% set foo = craft.app.request.getQueryParam('foo') %}
  
  {# get $_GET['foo']['bar'], if it exists #}
  {% set bar = craft.app.request.getQueryParam('foo.bar') %}
  
  ```
  
  
  ---
  
  