Javascript-jqueryajax program Problems

Source: Internet
Author: User
{Code ...} this ajax program is no problem when I put it on the HTML page (Url: www.lanxiang.comIndexajax_load_cartNum.html), but once the URL path of the ajax request for the js file is released separately, an additional Public directory (Url: www. lanxiang...
$(function(){    $.post("{:u('Index/ajax_load_cartNum')}",function(msg)    {           var oGoodsNum = document.getElementById('cartGoodsNum');        if(msg.flag)        {            oGoodsNum.innerHTML = msg.cartGoodsNum;        }        else        {            oGoodsNum.innerHTML = 0;        }        },'json')});

This ajax program I put on the HTML page is okay (Url: http://www.lanxiang.com/Index/ajax_load_cartNum.html ),
However, once the js file is released separately
The URL path of the ajax request will come out with a Public directory (Url: http://www.lanxiang.com/Public/%7B:u ('index/ajax_load_cartNum ') % 7D), the page contains this label

Reply content:
$(function(){    $.post("{:u('Index/ajax_load_cartNum')}",function(msg)    {           var oGoodsNum = document.getElementById('cartGoodsNum');        if(msg.flag)        {            oGoodsNum.innerHTML = msg.cartGoodsNum;        }        else        {            oGoodsNum.innerHTML = 0;        }        },'json')});

This ajax program I put on the HTML page is okay (Url: http://www.lanxiang.com/Index/ajax_load_cartNum.html ),
However, once the js file is released separately
The URL path of the ajax request will come out with a Public directory (Url: http://www.lanxiang.com/Public/%7B:u ('index/ajax_load_cartNum ') % 7D), the page contains this label

Personal guesses,{:u}Tag fromphpFile is not parsed.

Programming Problems + js files cannot parse php and can only be stored in php
DecodeURI ("http://www.lanxiang.com/Public/%7B:u ('index/ajax_load_cartNum ') % 7D ")
"Http://www.lanxiang.com/Public/{:u ('index/ajax_load_cartNum ')}"

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.