Ajax将查询字符串发送到asp .net [英] Ajax sending querystring to asp .net
本文介绍了Ajax将查询字符串发送到asp .net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我有一个ajax函数,可以将值发送到atualizaBD.aspx页面。
但是数据的值:$(form)。serialize()wehen read by processaFormulario()函数为null。
我显示了$(form)。serialize()值,它们没问题!
错误在哪里?
谢谢!
$ b $bFábio
巴西
default.aspx文件:
Hi all!
I have a ajax function that send values to atualizaBD.aspx page.
But the values of "data: $("form").serialize()" wehen read by processaFormulario() function are null.
I displayed the $("form").serialize() value and they are ok!
Is Where the error?
Thanks!
Fábio
Brazil
default.aspx file:
"Salvar BD": function() {
$.ajax({
type: "GET",
url: "../atualizaBD.aspx",
data: $("form").serialize(),
cache: false,
error: function(msg) { alert("Erro: " + msg); },
success: function(msg) {
alert("Ok!");
allFields.val("");
}
});
atualizaBD.aspx文件:
atualizaBD.aspx file:
Imports MySql.Data.MySqlClient
Imports System.Data
Imports System.IO
Imports System.Web
Partial Public Class _Default
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
processaFormulario()
End Sub
Private Sub processaFormulario()
Dim db As New DBConnection, dr As MySqlDataReader
Dim nome, email, senha, sql As String
nome = Request.QueryString("name")
email = Request.QueryString("email")
senha = Request.QueryString("password")
sql = "insert into teste (name, email, password) values ('" + nome + "','" + email + "','" + senha + "')"
db.abreBD()
db.executaComando(sql)
db.FechaDB()
End Sub
End Class
推荐答案
(form)。serialize()wehen read by processaFormulario( )函数为null。
我显示了
("form").serialize()" wehen read by processaFormulario() function are null.
I displayed the
(form)。serialize()值,它们没问题!
错误在哪里?
谢谢!
$ b $bFábio
巴西
default.aspx文件:
("form").serialize() value and they are ok!
Is Where the error?
Thanks!
Fábio
Brazil
default.aspx file:
"Salvar BD": function() {
.ajax({
type:GET,
url:../atualizaBD.aspx,
data:
.ajax({ type: "GET", url: "../atualizaBD.aspx", data:
这篇关于Ajax将查询字符串发送到asp .net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文