Jump to content

infomaniac50

Member
  • Posts

    3
  • Joined

  • Last visited

Everything posted by infomaniac50

  1. Yes. http://forum.whmcs.com/showthread.php?114138-Long-Markdown-Previews-are-broken-when-using-Ajax-GET-It-should-do-a-POST-instead
  2. I've been having a similar problem on our install as well. The content shows up blank after you click the preview button. If the content is short then it seems to work correctly. I suspect the URL in the GET request is too long. When sending that much content to the server it should really do a POST request. It violates the RESTful way of doing things but there not much that can be done about it when (Apache|Nginx|etc) refuses to cooperate. I posted a separate thread about how I debugged the issue. It is currently awaiting moderation but it has an explanation of how I successfully tested the preview with a POST request using the browser console.
  3. For whatever reason the Markdown preview is broken on our server when content is submitted with a GET request. I suspect the URL is too long and the server is rejecting it. When the preview is requested the content pane shows up empty. Raw JSON from the GET request. {"body":"\u003Cdiv class=\u0022markdown-content\u0022\u003E\n\u003C\/div\u003E"} I was able to jerry rig the page to send a POST request to see if that would fix the issue. The code I used to force it to use a POST request is listed below. I have verified that doing a POST instead of a GET request fixes the problem. I would fix it myself but it is an inline script which I assume is embedded in the ionCube encrypted bytecode. We are using the latest version of WHMCS 6.3.1. Our server runs cPanel, Apache 2.4, and WHMCS runs on PHP 5.6.30 This sends a plain GET request. var originalContent = e.getContent(), parsedContent; jQuery.ajax({ url: '/admin/supporttickets.php', async: false, data: {token: '<Dynamic Token Embedded Here>', action: 'parseMarkdown', content: originalContent}, success: function (data) { parsedContent = data; } }); return parsedContent.body ? parsedContent.body : ''; }, This will send a POST request instead of GET. var originalContent = e.getContent(), parsedContent; jQuery.ajax({ url: '/admin/supporttickets.php', type; 'POST', async: false, data: {token: '<Dynamic Token Embedded Here>', action: 'parseMarkdown', content: originalContent}, success: function (data) { parsedContent = data; } }); return parsedContent.body ? parsedContent.body : ''; }, Force All Ajax Requests to use the POST method $.ajaxPrefilter(function( options, originalOptions, jqXHR ) { options.type = "POST"; }); While testing I used the example Markdown from the help popover. Example Markdown **bold** *italics* ~~strikethrough~~ Headers # Big header ## Medium header ### Small header #### Tiny header Lists * Generic list item * Generic list item * Generic list item 1. Numbered list item 2. Numbered list item 3. Numbered list item Links [Text to display](http://www.example.com) Quotes > This is a quote. > It can span multiple lines! Tables | Column 1 | Column 2 | Column 3 | | -------- | -------- | -------- | | John | Doe | Male | | Mary | Smith | Female | Or without aligning the columns... | Column 1 | Column 2 | Column 3 | | -------- | -------- | -------- | | John | Doe | Male | | Mary | Smith | Female | Displaying code `var example = "hello!";` Or spanning multiple lines... ``` var example = "hello!"; alert(example); ```
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated