Answers.Body: <p>I believe the third parameter should be boolean not string, 1 or 0/ true or false</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-30T13:22:09.483Z
Answers.Text: Don't think so. `js/crm.ajax.js` defines it as 'front' or 'back' (if `mode` is not given, then it is set to one of those strings based on config); 'front' and 'back' are keys which are used to fetch from the `tplURL` var.
Answers.UserDisplayName: artfulrobot
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-30T14:04:49.760Z
Answers.Text: Here's the code reference: https://github.com/civicrm/civicrm-core/blob/master/js/crm.ajax.js#L10
Answers.UserDisplayName: William Mortada
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-11-30T12:26:04.543Z
Answers.LastActivityDate: 2020-11-30T12:26:04.543Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I'm trying to understand why the JavaScript function <code>CRM.url</code> gives different results depending on CMS. Can anyone explain?</p>
  <p>For example this code:</p>
  <pre><code>CRM.url('civicrm/payment/ipn/test', null, 'front')
  </code></pre>
  <p>In WordPress it returns the complete URL with the domain:</p>
  <p><code>http://wpmaster.localhost:7979/civicrm/civicrm/payment/ipn/test/</code></p>
  <p>Whereas in Drupal in returns the URL without the domain:</p>
  <p><code>/civicrm/payment/ipn/test</code></p>
  <p>This inconsistency feels wrong. Is it a bug in CiviCRM?</p>
  <p>For context I'm looking at this issue: <a href="https://github.com/artfulrobot/uk.artfulrobot.civicrm.gocardless/issues/97" rel="nofollow noreferrer">https://github.com/artfulrobot/uk.artfulrobot.civicrm.gocardless/issues/97</a></p>
  
Tags: <javascript>
Title: Why does CRM.url give different results in WordPress and Drupal?
ThreadText: # Why does CRM.url give different results in WordPress and Drupal?
  
  (Asked by: username_0 on 2020-11-30)
  
  I'm trying to understand why the JavaScript function CRM.url gives different results depending on CMS. Can anyone explain?
  For example this code:
  CRM.url('civicrm/payment/ipn/test', null, 'front')
  
  In WordPress it returns the complete URL with the domain:
  http://wpmaster.localhost:7979/civicrm/civicrm/payment/ipn/test/
  Whereas in Drupal in returns the URL without the domain:
  /civicrm/payment/ipn/test
  This inconsistency feels wrong. Is it a bug in CiviCRM?
  For context I'm looking at this issue: https://github.com/username_2/uk.username_2.civicrm.gocardless/issues/97
  
  **Tags:** javascript
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-11-30. Score: 0
  
  I believe the third parameter should be boolean not string, 1 or 0/ true or false
  
  > **Comments:**
  > **username_2**: Don't think so. `js/crm.ajax.js` defines it as 'front' or 'back' (if `mode` is not given, then it is set to one of those strings based on config); 'front' and 'back' are keys which are used to fetch from the `tplURL` var.  
  > **username_0**: Here's the code reference: https://github.com/civicrm/civicrm-core/blob/master/js/crm.ajax.js#L10  
  
  ---
  
  