js не надо было править, правильный адрес был
url:'http://lagonskaya.ru/public_htmls/ajax_forms.php',
--------------------
ajax_forms.php
<?php
include ('/home/cp339125/файл с библиотекой');
/**
* "файл с библиотекой" - это файл, где определяются функции getGeoData(), sendSalesForce(), logDebug(),
* и переменные $sales_force_oid, $debug, $admin_email, $client_ip
* без него работать не будет
*/
//if required fields does not set then exit
if( empty($_REQUEST["firstname"]) ||
empty($_REQUEST["lastname"]) ||
empty($_REQUEST["company"]) ||
empty($_REQUEST["position"]) ||
empty($_REQUEST["phone_country_code"]) ||
empty($_REQUEST["phone_part1"]) ||
empty($_REQUEST["phone_part2"]) ||
empty($_REQUEST["phone_part3"]) ||
empty($_REQUEST["phone"]) ||
empty($_REQUEST["email"])
)
throw new AjaxFormsAPI_Exception_InvalidParameter();
$firstname = $_REQUEST["firstname"];
$lastname = $_REQUEST["lastname"];
$company = $_REQUEST["company"];
$position = $_REQUEST["position"];
$phoneCountryCode = $_REQUEST['phone_country_code'];
$phonePart1 = $_REQUEST['phone_part1'];
$phonePart2 = $_REQUEST['phone_part2'];
$phonePart3 = $_REQUEST['phone_part3'];
$phoneExt = $_REQUEST['phone_ext'];
$email = $_REQUEST["email"];
$phone = '+' . $phoneCountryCode . '(' . $phonePart1. ')' . $phonePart2 . '-' . $phonePart3 . 'x' . $phoneExt;
$page_url = $_REQUEST["page_url"];
$prev_url = $_REQUEST["prev_url"];
/**
* Send data to sales force
*/
$post_fields = array(
"oid" => Config::$sales_force_oid,
"debug" => Config::$debug,
"debugEmail" => Config::$admin_email,
"lead_source" => "Contact Us",
"first_name" => $firstname,
"last_name" => $lastname,
"company" => $company,
"position" => $position,
"phone" => $phone,
"email" => $email
);
if($geoip_data = getGeoData($client_ip)){
$post_fields["city"] = $geoip_data["city"];
}
$result = sendSalesForce($post_fields);
$logger->logDebug(basename(__FILE__) . ": Send data to sales force:\n %s", var_export($result, true));
/**
* Save to DB
*/
$res = $forms->set(array(
"firstname" => $firstname,
"lastname" => $lastname,
"company" => $company,
"position" => $position,
"phone" => $phone,
"email" => $email,
"client_ip" => $client_ip,
"page_url" => $page_url,
"prev_url" => $prev_url
));
$logger->logDebug(basename(__FILE__) . ": Save data to DB : %s", var_export($res, true));
$_result=json_encode(array(
'code' => AJAX_FORMS_ERROR_CODE_SUCCESS,
'message' => false,
'redirect' => false
));
if(isset($_REQUEST['callback']))$_result="{$_REQUEST['callback']}($_result)";
die($_result);
break;
?>