SHOW:
|
|
- or go back to the newest paste.
| 1 | - | <!-- ======================= custom.js==================== --> |
| 1 | + | <?php |
| 2 | if(isset($_POST['selectedValue'])){
| |
| 3 | $display_data = $_POST['selectedValue']; | |
| 4 | - | $('.input-text').on("change", function () {
|
| 4 | + | echo "Anda Menulis: ".$display_data; |
| 5 | $ok=1; | |
| 6 | die(); | |
| 7 | }else{}
| |
| 8 | - | $('.fuck').text( selectedValue );
|
| 8 | + | |
| 9 | - | // alert($(this).val()); |
| 9 | + | if(!isset($ok)){
|
| 10 | ?> | |
| 11 | <hr/> | |
| 12 | <form action="" method="post"> | |
| 13 | - | url: "testos.php", |
| 13 | + | <input type="text" class="input-text" name="inputtxt" placeholder="Input Your Text"> |
| 14 | - | type: "POST", |
| 14 | + | </form> |
| 15 | - | data: {url : selectedValue},
|
| 15 | + | <div id='result'> </div> |
| 16 | - | success: function(){
|
| 16 | + | <script src='jquery-1.11.1.js'></script> |
| 17 | - | alert('success');
|
| 17 | + | <script> |
| 18 | - | }, |
| 18 | + | |
| 19 | - | error: function(){
|
| 19 | + | $('.input-text').on("keyup", function () {
|
| 20 | - | alert('error !');
|
| 20 | + | |
| 21 | var selectedValue = $(this).val(); | |
| 22 | var data = 'selectedValue='+selectedValue; | |
| 23 | ||
| 24 | //make the ajax call | |
| 25 | $.ajax({
| |
| 26 | - | <!-- ======================= testos.php ==================== --> |
| 26 | + | type: 'POST', |
| 27 | url: 'test.php', | |
| 28 | - | <!DOCTYPE html> |
| 28 | + | data: data, |
| 29 | - | <html lang="en"> |
| 29 | + | success: function(result) {
|
| 30 | - | <head> |
| 30 | + | console.log(result); |
| 31 | - | <meta charset="UTF-8"> |
| 31 | + | $('#result').html(result);
|
| 32 | - | <title>Document</title> |
| 32 | + | //prosess disini hasilnya |
| 33 | - | </head> |
| 33 | + | //alert('success !');
|
| 34 | - | <body> |
| 34 | + | |
| 35 | }); | |
| 36 | - | <?php |
| 36 | + | |
| 37 | - | $display_data = isset( $_POST['url'] ) ? $_POST['url'] : ''; |
| 37 | + | |
| 38 | - | echo $display_data; |
| 38 | + | </script> |
| 39 | - | var_dump($display_data); |
| 39 | + | <?php |
| 40 | - | ?> |
| 40 | + | } |
| 41 | ?> |