To solve the WordPress Use CDN blog post can not comment on the error _javascript skills

Source: Internet
Author: User

Comments-ajax.js after the CDN cache, many people encounter problems that cannot be answered (using AJAX). In this respect, my previous practice is only to prohibit the CDN to cache this file, then do not think of him.
The original solution is to be followed in the comments-ajax.js:

var i = 0, got =-1, len = document.getelementsbytagname (' script '). Length;
while (i <= len && got = = 1) {
  var js_url = document.getelementsbytagname (' script ') [I].src,
      got = Js_u Rl.indexof (' comments-ajax.js '); i++;
}

Add to:

Js_url = Js_url.replace (' CDN address ', ' your domain name ');

This will solve the problem.

Here's an example:

Js_url = Js_url.replace (' jb51.b0.upaiyun.com ', ' jb51.net ');

To this end, I made a little convenience to change, to add after "}":

var dm = Js_url.match (/http:\/\/([^\/]+) \//i);
Js_url = Js_url.replace (dm[1], ' Your domain name ');

This is OK, save a step to view and fill out the CDN domain name, just fill in its own domain name. It's not an example.

Of course, don't forget to refresh the cache at last. Update the Comments-ajax.js file of the CDN

WordPress After upgrading to 3.6, jquery uses the 1.10.2 version, and uses the jquery migrate to be compatible with the legacy jquery code. That is to ask for more than once.

This jquery migrate can be used to detect and recover APIs that have been deleted or obsolete in the jQuery1.9 version, but with a few more calls. This is not to remind us. Want to use the new jquery function function as soon as possible?!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.