Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $.ajax({
- url: apiurl,
- type: "POST",
- crossDomain: true,
- xhrFields: {
- withCredentials: true
- },
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- data: JSON.stringify(form_data)
- }).done(function (data) { //on success
- console.log("done);
- })
- $curl = curl_init();
- curl_setopt($curl, CURLOPT_POST, 1);
- curl_setopt($curl, CURLOPT_URL,$apiurl);
- curl_setopt($curl, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- ));
- curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
- $result = curl_exec($curl);
- return $result;
- $http_origin = $_SERVER['HTTP_ORIGIN'];
- header("Access-Control-Allow-Origin: $http_origin");
- // header('Access-Control-Allow-Origin: *');
- header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
- header('Access-Control-Allow-Credentials: true');
- header('Access-Control-Max-Age: 86400');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement