Web API post passes a parameter value that is always null

Source: Internet
Author: User

This problem has been tangled up in my morning, no matter what kind of method of communication, go to the controller, that parameter will never change equal to NULL

Find a lot of solutions on the Internet

The above is from the Internet, the first: to mark the parameter as [Frombody], to become a simple parameter

Second: It is the way to pass the argument.

I just started to try it this way, but ... Still is null, I have been very silent, tangled for a long time.

Finally, continue to surf the Internet to check the information, found that the method is correct, but the above-mentioned way for the $.ajax () there is no effect, the specific reason I also xiao not,

But if you use $.post (), you can get the value in the controller. It's so ...

Finally use the $.post, and then remember in the controller parameter plus [Frombody], as well as the parameter mode, "= Your parameters"

If you know why $.ajax () can't be realized can tell me ha ~

Above.

Web API post passes a parameter value that is always null

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.