Workaround: The JQuery Ajax Request backend method returns the current ASPX source problem

Source: Internet
Author: User

Recently received a reverse telecommuting, is to add some features on the original ASP. NET architecture, using jquery is 1.6.2 version, nonsense not much to say, directly on the code

Front Code

$.ajax ({type:"POST", URL:"Myphotolist.aspx/btnselectclick", ContentType:"Application/json", Data:"{‘Photoname': ' "+ currentphotoname +" ', 'Buttonval': ' "+currentbuttonval+" '} ",                    //dataType: "JSON",Successfunction(e) {alert (Success); }, Error:function(e) {alert ("Failed"); }                });

The above is a normal jquery Ajax method, look at the background code

     [WebMethod]    void  btncomment (String photoname, String commentstr) {       return  ;    }

The background method must add [WebMethod], in jquery two red places, respectively, corresponding to the background method of two parameters, the name can not be changed

However, in my system how also can not execute success, in the internet also found a lot of solutions are not, finally consulted my master, the problem solved

Because it is an old system, it is using. NET 2.0, which later changed to 3.5 or later issues solved

Click on Project, select Property page, select Production tab, Target framework changed to 3.5

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.