Нужно заменить текст в модальном окне, если $captcha не равно $pr, но jq не работает в php условии
function send_form(){
if (isset($_POST['pr'])){$pr = $_POST['pr']; if ($pr == '') {unset($pr);}}
if (isset($_POST['captcha'])){$captcha = $_POST['captcha'];}
/* Проверяем правильность ввода капчи */
if ($captcha == $pr){
$params["auth"]=$auth['AUTH_ID'];
curl_setopt($c,CURLOPT_RETURNTRANSFER,true);
curl_setopt($c,CURLOPT_POST,true);
curl_setopt($c,CURLOPT_POSTFIELDS,http_build_query(
array("fields" =>
array(
"TITLE" => $_REQUEST['title'],
"NAME" => $_REQUEST['name'],
"ADDRESS" => $_REQUEST['adres'],
"STATUS_ID" => "NEW",
"SOURCE_ID" => $source_id,
"OPENED" => "Y",
//"ASSIGNED_BY_ID" => 1,
"COMMENTS" => $_REQUEST['text'],
"PHONE" => array(array("VALUE" => $_REQUEST['phone'], "VALUE_TYPE" => "WORK")),
//'EMAIL'=> array( array( "VALUE" => $_REQUEST['email'], "VALUE_TYPE" => "WORK" ) ),
),
'params' => array("REGISTER_SONET_EVENT" => "Y")
)
));
$response=curl_exec($c);
$response=json_decode($response,true);
die();
}
else{ ?>
<script>
jQuery(".modal-body").html('Неправильні цифри');
</script>
<?php }
}
jQuery(document).ready(function(){
jQuery('#forma_obratnoj_svyazi').submit(function(){
var topvoprosform = jQuery(this);
jQuery.ajax({
url:topvoprosform.attr('action'),
method:'POST',
data:topvoprosform.serialize(),
success: function (response) {
jQuery('#submit-family').html(response);
jQuery('#formModalCenter').modal(focus);
}
});
return false;
});
});
<!-- Modal -->
<div class="modal fade" id="formModalCenter" tabindex="-1" role="dialog" aria-labelledby="formModalCenterTitle" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<div id="test" class="modal-body">Дякуемо за звернення!</div>
</div>
</div>
</div>