asp.net - JQuery getJSON() not working when checking email -
i have registration page checks webmethod see if particular value exists in db.
for email validation, have
//checks email against database. $(emailtextbox).blur(function () { if ($(this).val()) { email = encodeuri(escape($(this).val())); alert(email); $.getjson('/checkavailable.aspx?' + email + ".email", function (results) { if (results.email == "true") { availabilityemail.html('<img src="/app_themes/defaulttheme/misc/tick.png"/>'); email = true; checkvalid(); } else { availabilityemail.html('<img src="/app_themes/defaulttheme/misc/cross.png"/>'); email = false; checkvalid(); } }); } });
which uses
private string getemail(string email) { const string strsql = "select memberemail someview memberemail = @email"; var sqlcomm = new sqlcommand(strsql, dataconn.connect()) { commandtype = commandtype.text }; sqlcomm.parameters.add(new sqlparameter("@email", sqldbtype.varchar, 255)).value = email; string rdr = (string)sqlcomm.executescalar(); return !string.isnullorempty(rdr) ? "\"" + "email" + "\"" + " : " + "\"" + "false" + "\"" : "\"" + "email" + "\"" + " : " + "\"" + "true" + "\"" + "\n"; }
but seems though jquery
method never posts when use .
. i've tried escape \\.
, still doesn't work.
can help?
edit:
using encodeuri or not makes no difference. trying convert string value also, comes same result.
debug application , check json result being returned pasting in json validator such jsonlint.com. looks of things, json missing commas.
check out more json on wiki.
Comments
Post a Comment