How can I request the orderAction () method on the Controller page using the $ post () method in phpMVC?

Source: Internet
Author: User
How can I request the orderAction () method on the Controller page using the $ post () method in phpMVC? in php MVC, how can I request the orderAction () method on the Controller page using the $ post () method?
// This is the request address I wrote.
$ OrderUrl = 'HTTP: // '. $ _ SERVER ['HTTP _ host'].'/Ehking/Controller/OnlinePayController. php/order ';
$. Post (
\ ''. $ OrderUrl .'\',
{
MerchantId: \ ''. $ merchantId .'\',
Policyurl: \ ''. $ policyurl .'\',
CallbackUrl: \ ''. $ callbackUrl .'\',
RequestId: \ ''. $ requestId .'\',
OrderAmount: \ ''. $ orderAmount .'\',
OrderCurrency: \ ''. $ orderCurrency .'\',
PaymentModeCode: \ ''. $ paymentModeCode .'\',
Remark: \ ''. $ remark .'\',
MerchantUserId: \ ''. $ merchantUserId .'\',
PayerName: \ ''. $ payerName .'\',
PhoneNum: \ ''. $ phoneNum .'\',
IdType: \ ''. $ idType .'\',
BankCardNum: \ ''. $ bankCardNum .'\',
Email: \ ''. $ email .'\',
CardNo: \ ''. $ cardNo .'\',
Cvv2: \ ''. $ cvv2 .'\',
ExpiryDate: \ ''. $ expiryDate .'\',
Name: \ ''. $ name .'\',
Inclueno: \ ''. $ inclueno .'\',
CashierVersion: \ ''. $ cashierVersion .'\',
ForUse: \ ''. $ forUse .'\',
BindCardId: \ ''. $ bindCardId .'\',
Details: '. $ product .'
},
Function (data, status ){
Alert (data );
If (data = 1 ){
Alert (\ 'server processing succeeded \');

} Else {
Alert (\ 'server processing failed \');

}
}
);


Reply to discussion (solution)

Public function orderAction ()
{
// $ MerchantId =$ _ POST ['merchantid'];
// Echo '. $ merchantId .';
Echo '20140901 ';
}

This is the orderAction () method in my class OnlinePayController.

Where did your pile of code be written?
Check whether the error is correct in the browser.

Where did your pile of code be written?
Check whether the error is correct in the browser.



On a page written in the background, I transfer the background data to the foreground page, which is equivalent to a front-end button generated in the background, the onclick event of this button executes this $ post ()..............

I have found the answer. This is a class method. First, instantiate this class OnlinePayController and then call the orderAction () method in it.

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.