Похожие чаты

Can anyone give me a simple ajax code that sends

data to php and which can be further processed and added to database?
This is in index.html
<script type =text /javascript >
$.ajax({url:"http://localhost:8080/a/insert.php", type: "post", data: {fname:'Sidharth' , lname:'Jain' }});
$.get("http://localhost:8080/a/insert.php", function(data){
alert(data) ;}
</script>
And this in insert.php
<?php
$fname = $_POST['fname'] ;
$lname = $_POST['lname'] ;
echo "My name is ".$fname." ".$lname ;


?>

1 ответов

5 просмотров

...you are already done... Your PHP now needs to put that stuff into the database. If further processing is needed you eithger extend your PHP backend with the neccesary logic, or your JS and then just send it to the PHP Also make sure to use isset() in the PHP

Похожие вопросы

Обсуждают сегодня

Ясн. Но я всеравно к кедам отношусь с опасением. Чисто субьективное кедосозерцание. Что касаемо "восторга изяшности кед" так и не вкурил, хотя много слышал, пока не поставил с...
Артем Записной
30
type TObj = object procedure Init; virtual; end; TObj1 = object(TObj) procedure Init; override; end; procedure TObj1.Init; begin inherited; end; procedur...
Alexander 👋
29
Есть какой-нибудь для Delphi/FPC T*Compression(Decompression)Stream на базе LZ4/Zstd/любой другой быстрый(и хорошо сжимающий) алгоритм А ещё лучше в pure pascal А ещё лучше од...
notme
45
How can a minority hashrate chain defend from a fork-hopping ASIC miner? The problem: 1. A miner comes into your network, and mines at 60-70% hashrate. 2. After some time, th...
Kishniev
13
А чем вам питонисты не угодили?😂
.
79
Hey guys, did you see the new announcement about $Fun? 🔥
Filip Murphy
55
Hey people, how do I unstake from the old pool and stake in the new pool??
Dyldo Baggins
24
Можно ли загрузить скрипт py в бота чтобы он работал по нему? как это сделать?
huskadam #RCC Фанат? @hitlerpvp
13
А дин типизация это хорошо или плохо?
Alexey
12
Исходники плюс документация? Вы гоните)) демок хватит всем
zamtmn
11
Карта сайта