Monday, 15 September 2014

php - Ajax calls getting error[object Object] -



php - Ajax calls getting error[object Object] -

hello getting error[object object] while trying pass value through ajax calls. using jquery selector value of checkbox. , trying pass through ajax can checkbox value have selected.but getting error.thanks. here code:

dashboard.php

if($param['aktion'] == 'save-widget-vehicle') { $page['register-fahrzeuge'] = array( 1 => array( 'fahrzeug','aktiv',$page['script'],''), 0 => array( 'edit-fahrzeug','enabled',$page['script'],'',''), ); $opts = !empty($param['filteropts']) ? $param['filteropts'] : array(); $tmp = array(); foreach ($opts $opt) { $tmp[] = '"'.$opt.'"'; } $query = 'select fahrzeuge.dsnr,name fahrzeuge inner bring together ohne_fahrzeuge on fahrzeuge.dsnr = ohne_fahrzeuge.dsnr fahrzeuge.name in ('.implode(",", $tmp).')'; $result = mysql_query($query, $myconnection); $data = array(); $html = '<table width="538" cellspacing="0" cellpadding="0" border="0"> <tr> <td> <div>'.createregister($page['register-news']).'</div> '.createmessage().' <div class="cont-liste-verlauf register"> '; while($row = mysql_fetch_array($result)){ //$news_result = $fahrzeuge['name']; $html .= '<table id="fahrzeuge"> <tr> <td> <a href="amo_fahrzeuge.php"> '. $data[] = $row .'</a> </td> </tr> '; } $html .= '</table> </div> </td> </tr> </table>'; $return = array( 'status' => 1, 'html' => $html ); echo json_encode($return); die(); $param['aktion'] = 'get-widget-vehicle'; }

dashboard.js

function getfahrzeuge() { var opts = []; $("input[type=checkbox]").each(function () { if (this.checked) { opts.push($(this).attr("id")); } }); homecoming opts; } function savefahrzeugewidget(opts){ if(!opts || !opts.length){ opts = allfahrzeuge; } $.ajax({ type: "post", url: "ajax/dashboard.php", datatype : 'json', cache: false, data: {filteropts: opts, 'aktion' : 'save-widget-vehicle'}, success: function(data){ // $('#fahrzeuge').html(maketable(records)); $('#fahrzeuge').html(data.html); }, error: function(data){ alert('error' + data); } }); } $('#fahrzeuge .butt-rahmen').live('click', function(){ if($(this).attr('id') == 'submitid') var opts = getfahrzeuge(); savefahrzeugewidget(opts); }); var allfahrzeuge = []; $("input[type=checkbox]").each(function(){ allfahrzeuge.push($(this)[0].id) })

php jquery ajax error-handling jquery-selectors

No comments:

Post a Comment