Вызов Dialog Box
Выбираю через select box (страница my_test_select_box.php) необходимый атрибут и передаю его (POSTOM) через AJAX.
На странице, которая принимает данное значение формирую ссылку. <a href="my_input_value=<?=$test_value?>" title="Ссылка для вызова"><input type="button" value="+"></a> При нажатии на ссылку формирую dialog box, при этом Get-ом забираю значение. <script type="text/javascript"> $(function () { $("#dialog-comments").dialog({ modal: true, autoOpen: false, title: "Add test comment...", height: "auto", width: 100, position: { my: "center", at: "center", of: window }, buttons: [ { text: "Save", click: function() { var test_value_= $('#test_value').val(); var hrf = my_test_select_box.php } $.ajax({ url: 'my test_php.php',//operation with my value method:"POST", data: { test_value_:test_value_ }, success: function (data){ $("#dialog-comments").dialog("close"); window.location.href = hrf; } }) } }, { text: "Close", click: function() { var hrf = my_test_select_box.php } $(this).dialog("close"); window.location.href = hrf; } }] }); $(document).ready(function() { $("#dialog-comments").dialog('open'); }); }); </script> if (isset($_GET['my_input_value'])) { $new_value = $_GET['my_input_value']; <div id = "dialog-comments"> <p><input type="text" name = "test_value" id = "test_value" value = "$new_value"></p> </div> } Как вызвать dialog box на странице где происходит выбор значения, т.е. my_select_box.php, потому что так как я написал происходит вызов dialog box на той странице, куда указывает ссылка. |
Часовой пояс GMT +3, время: 23:52. |