Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ============================1.sayfa=================
- <?php session_start(); ?>
- <!DOCTYPE html>
- <html>
- <body>
- <button type="submit" id="ilacekle">TEST</button>
- <input type="text" name="param">
- <?php echo $_SESSION["id"];?>
- <div class="result"></div>
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
- <script>
- $(document).ready(function () {
- $("#ilacekle").click(function (event) {
- event.preventDefault();
- var formData = {
- 'ilacId': $('input[name=param]').val()
- };
- $.ajax({
- context: this,
- type: 'POST',
- url: 'ajax2.php',
- data: formData,
- dataType: 'json',
- encode: true,
- success: function (data) {
- console.log(data);
- $(".result").html(JSON.stringify(data));
- }
- });
- });
- });
- </script>
- </body>
- </html>
- ============================2.sayfa=================
- <?php
- session_start();
- $_SESSION['id'] = $_POST['ilacId'];
- $data['ilacId'] = $_POST['ilacId'];
- $data['success'] = true;
- $data['message'] = 'Success!';
- echo json_encode($data);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement