F
F
frees22018-02-15 22:05:47
JavaScript
frees2, 2018-02-15 22:05:47

Preloading with a form, using ajax as an example, other solutions?

Good evening. I would like to find other versions of scripts, modern ones, and not just this one, see below. To learn different modern possibilities of such work with forms. Who will advise what?
An example, you can use links in the form. What are the modern solutions, other scripts similar to this one?
index.php

<!DOCTYPE html>
<html><head><meta charset="utf-8" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<title>YouTube</title>




<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.form/4.2.2/jquery.form.min.js"
 integrity="sha384-FzT3vTVGXqf7wRfy8k4BiyzvbNfeYjK+frTVqZeNDFl8woCbF0CYG6g2fMEFFo/i" crossorigin="anonymous"></script>

 
</head><body>

 <script>
$(document).ready(function(){$('#htmlForm').ajaxForm({target:'#htmlExampleTarget',success:function(){$('#htmlExampleTarget').fadeIn('slow'); }});});
</script>

 
 
<form id="htmlForm" action="html-echo.php" method="post"> 
    Message: <input type="text" name="message" value="Hello HTML" /> 
    <input type="submit" value="Echo as HTML" /> 
</form>
<div id="htmlExampleTarget"></div>

</body></html>


html-echo.php
<?php 
echo '<div style="background-color:#ffa; padding:20px">' . $_POST['message'] . '</div>'; 
?>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question