P
P
pevec12016-11-21 11:29:11
JavaScript
pevec1, 2016-11-21 11:29:11

After $.post request the Continue button is not clicked. How to fix it?

After $.post request the Continue button is not clicked. How to fix it?
Here are the codes:

$(function() {
  $( "#accordion" ).accordion({
    autoHeight: false,
    navigation: true,
    animated: false,
    collapsible: true,
    active: false
  });
    
  $( "#count" ).dialog({
    autoOpen: false,
    show: "blind",
    hide: "blind",
    buttons: {
      Продолжить: function() {
        $.post(
          '/add_to_cart_1.php',
          {
            name: $("#obj_name_").val(),
            price: $("#obj_price").val(),
            count: $("#obj_count").val(),
            number: $("#obj_number").val(),
            part_id: $("#obj_id").val(),
            typ: $("#obj_typ").val(),
            ses_id: ses_id
          },
          onAjaxSuccesss
          );
          function onAjaxSuccesss(data)
          {
            // Здесь мы получаем данные, отправленные сервером
            if (data == 1){
              window.location.replace("cart1.php");
              //window.location = loc;
              //$( this ).dialog( "close" );
            }
            else{	
              $( "#count_err" ).empty();
              $( "#count_err" ).append(data);
            }
          }					
      },
      Отмена: function() {
        $( this ).dialog( "close" );
      }
    }
  });
})
function add_to_cart_1(typ, part_id, name, price, number){
  $("#count_err").empty();
  $("#obj_name").empty();
  $("#obj_name").append(name);
  $("#obj_name_").val(name);
  $("#obj_price").val(price);
  $("#obj_count").val('1');
  $("#obj_number").val(number);
  $("#obj_id").val(part_id);
  $("#obj_typ").val(typ);
  $("#count").dialog("open");
}


<a href="javascript:add_to_cart_1(\'froza\', \''.$line_arr["make_name"].'\', \''.iconv("utf-8","CP1251",$line_arr["description_rus"]).'\', \''.$line_arr["price"].'\', \''.$line_arr["detail_num"].'\')"><img src="/images/add_to_cart.png" style="border: none" alt="Добавить в корзину" title="Добавить в корзину"></a>

<div id="count" style="display: none;">
  <div id="count_err" style="color:red"></div>
  Укажите количество:
  <div style="font-size:small;">	
    <span id="obj_name"></span><br/>
    <input type="hidden" id="obj_name_">
    <input type="hidden" id="obj_price">
    <input type="hidden" id="obj_number">
    <input type="hidden" id="obj_typ">
    <input type="hidden" id="obj_id">
    <input id="obj_count" value="1">
  </div>
  </div>

if ($typ=='exel') {
код 
    exit;
  } elseif ($typ=='froza') {
код
  exit;
  }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question