jquery ui checkbox button not submitting with ajax

jquery ui checkbox button not submitting with ajax

I have a problem, where the checkbox is not submitting any values. The code snippets looks like this (html, JS, PHP):

  1.         <div id="checkboxes">
               <input type="checkbox" name="ed" id="ed" value="ed"><label for="ed">ed</label>
               <input type="checkbox" name="vw" id="vw" value="vw"><label for="vw">vw</label>   
            </div>


  1.       var $form = $("#meineprodukte");
          var method = $form.attr("method") ? $form.attr("method").toUpperCase() : "GET";
          $.ajax({
             url: $form.attr("action"),
             data: $form.serialize(),
             type: method,
             success: function(data) {


  1. <?php
       // AJAX Abfrage
       if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
          if($REX['REDAXO']!=1) while(ob_end_clean());

          $sql = new sql();
          $query = 'SELECT * FROM '.$REX['TABLE_PREFIX'].'meineprodukte';
          $cond = array();
          if (isset($_REQUEST['ed'])) {
             $cond[] = 'ed = "'.mysql_real_escape_string($_REQUEST['ed']).'"';
          }
          if (isset($_REQUEST['vw'])) {
             $cond[] = 'vw = "'.mysql_real_escape_string($_REQUEST['vw']).'"';
          }
          if (!isset($_REQUEST['vw']) and !isset($_REQUEST['ed'])) {
             $cond[] = '1=2';
          }
          if (count($cond)) {
             $query .= ' WHERE ' . implode(' AND ', $cond);
          }
          $sql->setQuery($query.';');


          if($sql->getRows()){
             for($i = 0; $i < $sql->getRows(); $i ++){
                $array[]=array('bilddatei'=>$sql->getValue('bilddatei'),'produktbezeichnung'=>$sql->getValue('produktbezeichnung'));
                $sql->next();
             }
             //header("Content-Type: application/json", true);
             echo json_encode( $array );
          } else echo '{}';
          die();       
       }
    ?>
    • Topic Participants

    • foren