如何写数据:在javascript中? [英] How to write data: in javascript?

查看:88
本文介绍了如何写数据:在javascript中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网上看了很多文章,但我仍然没有得到正确答案的答案..



这是我试过的代码.. < br $>


I read many article on web but I still don''t get the answer to make things right..

This is code that I tried..

$.ajax({
type: "POST",
url: "../include/insert_user.php",
data: "name="+ name+ "email="+ email,
});





我试图在php中将它插入这样的数据库:



And I tried to insert it in database like this in php:

$name = mysql_real_escape_string($_POST['name']);
$email = mysql_real_escape_string($_POST['email']);

mysql_query("INSERT INTO user(name, email) VALUES('$name', '$email')");





如果name = john和email =john@mail.com



$ name中的输出数据为johnemail=john@mail.com(不带),$ email中没有任何内容



如何编写代码,以便数据:输出将是john和john@mail.com在2个单独的数据中??

任何人都可以给我一个帮助或参考解决这个问题??



Example if name=john and email=john@mail.com

The output data will be "johnemail=john@mail.com" (without "") in $name and nothing in $email

How must I write the code so the data: output will be john and john@mail.com in 2 separate data??
Can anyone give me a help or reference to solve this??

推荐答案

.ajax({
type:POST,
url:../ include /insert_user.php ,
数据:name =+ name +email =+ email,
});
.ajax({ type: "POST", url: "../include/insert_user.php", data: "name="+ name+ "email="+ email, });





我试图在php中将它插入数据库中这样:



And I tried to insert it in database like this in php:


name = mysql_real_escape_string(
name = mysql_real_escape_string(


_POST [' 名称]);
_POST['name']);


这篇关于如何写数据:在javascript中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆