D
D
del9937882016-03-27 18:21:45
PHP
del993788, 2016-03-27 18:21:45

How to implement ajax registration in dle?

Help implement ajax registration in dle. Here is the code from the Dle API. It is responsible for registering users.

$dle_api->external_register( string $login, string $password, string $email, int $group);

I roughly sketched out part of the code, although this seems to me incorrect.
<form enctype="multipart/form-data" method="post" id="ajaxreg" class="rel">
<input type="text" name="ajaxname" id="ajaxname" placeholder="Логин">
<input type="text" name="ajaxpass" id="ajaxpass" placeholder="Пароль">
<input type="text" name="ajaxmail" id="ajaxmail" placeholder="Почта">
<input type="submit" id="submit" value="Зарегистрироваться">
</form>

$(function(){
    'use strict';
    $('#submit').on('submit', function(e){
    $.ajax({
        type: "POST",
        url: "/engine/ajax/ajaxreg.php", // Имя файла к которому будет идти AJAX запрос
        data:  // Не знаю, что в дату писать...
        success: function(data){
            alert(data.success); // Итог
        }
    });
}
});

And I don't know at all what to write in php other than this:
<?php
include ('engine/api/api.class.php');
$email = $_POST['ajaxmail'];
$login = $_POST['ajaxname'];
$password = $_POST['ajaxpass'];
$dle_api->external_register( string $login, string $password, string $email, int $group);

Please help me improve my php and js code.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Molchanov, 2016-03-28
@johny_cat

Usually such modules are written to order, but you can write to me in VK with the note "ajax registration in dle (from the toaster)" and there we will figure it out :3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question