javascript dialog box is not appearing on button click using js,ajax,php -
hi have dialog box should open on button click , display message 'it works' inside dialog box. dont know why after button click dialog box not appearing.thank you.
here js code:
function getaddwidget() { $.ajax({ type: "post", url: "ajax/dashboard.php", datatype : 'json', cache: false, data: {'aktion' : 'add-new-widget'}, success: function(data){ $('#addwidget').html(data.html); }, error: function(data){ alert('error'); //$('#news').html(data.html); } }); } $(function() { $( "#dialog" ).dialog({ autoopen: false, show: { effect: "blind", duration: 1000 }, hide: { effect: "explode", duration: 1000 } }); $('#addwidget .butt-rahmen').live('click', function(){ if($(this).attr('id') == 'addwidgetid') $( "#dialog" ).dialog( "open" ); getaddwidget(); }); });
dashboard.php
if($param['aktion'] == 'add-new-widget') { $html = '<table width="538" cellspacing="0" cellpadding="0" border="0"> <tr> <td id="addwidget"> <div id="dialog"> <p>it works!!!</p> </div> </td> </tr> </table>'; $return = array( 'status' => 1, 'html' => $html ); echo json_encode($return); die(); }
Comments
Post a Comment