Magento에서 PHP webservice에 AJAX 호출을하려고합니다. 여기에 내 PHP 코드 스 니펫이 있습니다.AJAX 호출이 작동하지 않습니다 (오류 302) Magento
<?php
$callbackUrl = "http://localhost/magento/webservices/NewCustomer1.php";
//intiate oauth callback URL
$temporaryCredentialsRequestUrl = "http://localhost/magento/oauth/initiate?oauth_callback=". urlencode($callbackUrl);
$adminAuthorizationUrl = 'http://localhost/magento/admin/oauth_authorize';
$accessTokenRequestUrl = 'http://localhost/magento/oauth/token';
//Magento rest API URL
$apiUrl = 'http://localhost/magento/api/rest';
//Consumer key and secret
$consumerKey = 's3xt7w8lwhfrrfzrfvwm3lrilkf66d5n';
$consumerSecret = 'vr3eq1x899pz1cf4zzxjzx3q03t66r3n';
//get customer attributes
$firstname=$_POST['fname'];
$lastname=$_POST['lname'];
$email=$_POST['email'];
.......
여기에 302 찾을 오류가 발생하고 제출에 내 JQuery와
$('#btnSubmit').click(function(){
console.log("Submit Clicked");
var fName=$('#firstname').val();
var lName=$('#lastname').val();
var email=$('#email_address').val();
var password=$('#password').val();
var pass_conf=$('#confirmation').val();
var dataString = 'fname='+ fName + '&lname=' + lName + '&email=' + email + '&password=' +password+ '&webid=1&groupid=1';
/*http://localhost/magento/webservices/Newcustomer1.php?fname=siri&lname=s&[email protected]&password=password123&webid=1&groupid=1*/
//your validation code
$.ajax({
url: 'http://localhost/magento/webservices/Newcustomer1.php',
type: 'POST',
data: dataString,
success: function(data) {
$('#message').html(data);
}
});
});
입니다. URL 자체에 매개 변수를 전달하고 $ _REQUEST를 $ _GET으로 변경하면 작동합니다. 사전에
감사합니다.
302 요청한 URL이 리디렉션을위한 초대로 응답하면 Found가 발생합니다. 내 생각 엔 당신이 인증을 시도하는 동안 발생하는 것입니다 ... –