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);
```