Good afternoon, this question: there is a form:

<form name="create_page" action="create_page" id="create_page1"> <input name="pcreate" type="text" value="Введите имя страницы " id="enter_nameP"></br> <label for="enter_nameP" >с расширением (.php)</label><br> <input type="submit" value="Создать"> </form> 

there is a file addressed by the form, inside it there is a script for creating and writing a file with the name of what was entered into the text input. Coming up to another page when clicking on a submit, but how to do it, what would all this happen in the background?

those. Clicked, a notification came out that it was created and that's it.

I will be grateful for the help, I'm just not very familiar with JQ, if at all it can be implemented on it.

    1 answer 1

    Well, from the side of JS it will look something like this:

      //Сюда мы попадем когда кликнем на кнопку отправки формы $("#create_page1").submit(function (event) { // Говорим браузеру что не нужно отправлять форму и мы сами разберемся что дальше делать event.preventDefault(); //получаем какие-то данные с формы var name = $("#enter_nameP").val(); //создаем запрос Ajax $.ajax({ type: 'POST', url: "create_page.php", data: name }).done(function (data) { //Сюда мы попадем если все ок //Выводим уведомление пользователю какое-то и тд }).fail(function (data) { //Сюда мы попадем если запрос Ajax обработать не удалось }); }); 

    read more about jquery Ajax here