Hi mensen,
ik wil in mijn Zend applicatie voor een delete-actie een jquery dialog openen maar loop tegen een klein probleem aan.
Als alternatief probeer ik het volgende maar ook daar zit ik met een denkfout..
Ik krijg echter in document.location niet de id meegestuurd.
Enig idee wat ik fout doe?
ik wil in mijn Zend applicatie voor een delete-actie een jquery dialog openen maar loop tegen een klein probleem aan.
HTML:
1
| <a href="#" id="<?php echo $page->id; ?>">click here</a> |
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| <?php $this->jQuery()->addOnLoad(" $('a').click(function(){ nr = $('a').attr('id'); $('#dialog').data('id', nr ).dialog('open'); }); "); ?> <?php echo $this->dialogContainer( 'dialog', 'Are you sure you want to delete this page?', array( 'autoOpen' => false, 'draggable' => true, 'modal' => true, 'resizable' => true, 'title' => 'Confirm Delete', 'closeOnEscape' => true, 'buttons' => array( 'Delete' => new Zend_Json_Expr('function() { document.location = "/admin/page/delete/id/"+id }'), 'Cancel' => new Zend_Json_Expr('function() { $(this).dialog(\'close\'); }') ) ) ); ?> |
Als alternatief probeer ik het volgende maar ook daar zit ik met een denkfout..
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| <?php echo $this->dialogContainer( 'dialog', 'Are you sure you want to delete this page?', array( 'autoOpen' => false, 'draggable' => true, 'modal' => true, 'resizable' => true, 'title' => 'Confirm Delete', 'closeOnEscape' => true, 'buttons' => array( 'Delete' => new Zend_Json_Expr('function() { var nr = $(\'#dialog\').data(\'nr\'); document.location=\''.$this->url(array( 'module' => 'admin', 'controller' => 'page', 'action' => 'delete', 'id' => 'nr' ),"", true) .'\' }'), 'Cancel' => new Zend_Json_Expr('function() { $(this).dialog(\'close\'); }') ) ) ); ?> |
Ik krijg echter in document.location niet de id meegestuurd.
Enig idee wat ik fout doe?
[ Voor 28% gewijzigd door Verwijderd op 26-05-2012 13:45 ]