Answers.Body: <p>The problem was WP Bakery and how it hijacks the page; getting rid of WP Bakery for a simpler page editor was the solution.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-11T15:21:41.243Z
Answers.LastActivityDate: 2020-03-11T15:21:41.243Z
Answers.UserDisplayName: BlueDogRanch
Body: <p>When a WordPress page editor plugin is activated (WP Bakery) I get the console errors on a page using the shortcode <code>[civicrm component="profile" gid="14" mode="create" hijack="0"]</code>.</p>
  
  <blockquote>
    <p>The script from
    “<a href="https://example.org/civicrm/?page=CiviCRM&amp;q=civicrm/ajax/l10n-js/en_US&amp;cid=13243&amp;r=nPFxX" rel="nofollow noreferrer">https://example.org/civicrm/?page=CiviCRM&amp;q=civicrm/ajax/l10n-js/en_US&amp;cid=13243&amp;r=nPFxX</a>”
    was loaded even though its MIME type (“text/html”) is not a valid
    JavaScript MIME type.</p>
    
    <p>SyntaxError: expected expression, got '&lt;' on line one of the dcocument</p>
  </blockquote>
  
  <p>The page uses the Classic editor, not WPBakery. I've tried various plugins to disable the WP Bakery plugin on that one page, with no luck.</p>
  
  <p>Disabling WP Bakery for the whole site allows the shortcodes to work; but it can't be deactivated due to client usage. I'm also trying to work with WP Bakery support.</p>
  
  <p>As a result of the errors, no CiviCRM search results are returned.</p>
  
  <p>Any ideas?</p>
  
  <p>No errors in any WP or CiviCRM error logs.</p>
  
  <p>Going directly to the URL of the Javascipt doesn't load the script, but loads the entire page.</p>
  
  <p>Is it possible to enqueue the CiviCRM script in the footer or change its load order to help troubleshoot?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-13T17:53:47.037Z
Comments.Text: What do you see when you visit that example.org url on its own? It's expecting a javascript script but is getting html.
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-13T18:15:37.347Z
Comments.Text: When going directly to that URL, I get the full page; that's the error.
Comments.UserDisplayName: BlueDogRanch
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-13T18:24:09.577Z
Comments.Text: When you go to the url in your post that has ajax/l10n etc in it?
Comments.UserDisplayName: Demerit
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-13T18:26:50.497Z
Comments.Text: Yes, the complete URL; but no console errors.
Comments.UserDisplayName: BlueDogRanch
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-14T17:02:29.193Z
Comments.Text: This usually means there's a PHP error of some kind - instead of returning valid Javacript, the return is a HTML error page. Check your WordPress and CiviCRM logs.
Comments.UserDisplayName: Christian Wach
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-14T17:15:13.047Z
Comments.Text: Nothing in WP or CiviCRM logs.
Comments.UserDisplayName: BlueDogRanch
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-14T18:44:08.607Z
Comments.Text: Is it possible to enqueue the CiviCRM script in the footer or change its load order to help troubleshoot?
Comments.UserDisplayName: BlueDogRanch
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-11-15T21:32:52.383Z
Comments.Text: I can't mark this as a duplicate because of the open bounty - but could you say how this is different from https://civicrm.stackexchange.com/q/5084/12 or https://civicrm.stackexchange.com/q/27712/12?  If not, could you post the text injected at the top of the file you link above?
Comments.UserDisplayName: Jon G - Megaphone Tech
Tags: <wordpress>
Title: Search ajax script "not a valid JavaScript MIME type"
ThreadText: # Search ajax script "not a valid JavaScript MIME type"
  
  (Asked by: username_0 on 2019-11-13)
  
  When a WordPress page editor plugin is activated (WP Bakery) I get the console errors on a page using the shortcode `[civicrm component="profile" gid="14" mode="create" hijack="0"]`.
  
  > The script from
  > “<https://example.org/civicrm/?page=CiviCRM&q=civicrm/ajax/l10n-js/en_US&cid=13243&r=nPFxX>”
  > was loaded even though its MIME type (“text/html”) is not a valid
  > JavaScript MIME type.
  >
  > SyntaxError: expected expression, got '<' on line one of the dcocument
  
  The page uses the Classic editor, not WPBakery. I've tried various plugins to disable the WP Bakery plugin on that one page, with no luck.
  
  Disabling WP Bakery for the whole site allows the shortcodes to work; but it can't be deactivated due to client usage. I'm also trying to work with WP Bakery support.
  
  As a result of the errors, no CiviCRM search results are returned.
  
  Any ideas?
  
  No errors in any WP or CiviCRM error logs.
  
  Going directly to the URL of the Javascipt doesn't load the script, but loads the entire page.
  
  Is it possible to enqueue the CiviCRM script in the footer or change its load order to help troubleshoot?
  
  **Tags:** wordpress
  
  > **Comments:**
  > **username_1**: What do you see when you visit that example.org url on its own? It's expecting a javascript script but is getting html.  
  > **username_0**: When going directly to that URL, I get the full page; that's the error.  
  > **username_1**: When you go to the url in your post that has ajax/l10n etc in it?  
  > **username_0**: Yes, the complete URL; but no console errors.  
  > **username_2**: This usually means there's a PHP error of some kind - instead of returning valid Javacript, the return is a HTML error page. Check your WordPress and CiviCRM logs.  
  > **username_0**: Nothing in WP or CiviCRM logs.  
  > **username_0**: Is it possible to enqueue the CiviCRM script in the footer or change its load order to help troubleshoot?  
  > **username_3**: I can't mark this as a duplicate because of the open bounty - but could you say how this is different from https://civicrm.stackexchange.com/q/5084/12 or https://civicrm.stackexchange.com/q/27712/12?  If not, could you post the text injected at the top of the file you link above?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2020-03-11. Score: 1
  
  The problem was WP Bakery and how it hijacks the page; getting rid of WP Bakery for a simpler page editor was the solution.
  
  
  ---
  
  