I am trying to impliment facebook registration pluging from last three weeks, to check the username avaiablity I am using jquery and JSON, accourding to this http://developers.facebook.com/docs/plugins/registration/advanced/ guide, with the following code I am able to send username to my server that is a a c# page to check either it is available or not, but how to tell back?
Problem is this I don’t know how to send message from c# page to the calling scritp, and how to use read it here.
<body>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js#appId=134552926621797&xfbml=1"></script>
<fb:registration redirect-uri="http://dev2.urecommendme.com/test3.aspx"
fields='[{"name":"name"},
{"name":"username","description":"Username","type":"text"}]'
onvalidate="validate_async"></fb:registration>
<script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
<script>
function validate_async(form, cb) {
$.getJSON('http://dev2.urecommendme.com/test01.aspx?username=' + form.username + '&callback=?',
function (response) {
if (response.error) {
// Username isn't taken, let the form submit
cb();
}
alert(cb.toString());
});
}
</script>
</body>
Returning message should be something like this
<script src="http://graph.facebook.com/shahidgfdgd?callback=jsonp1307613510850">
jsonp1307613510850({
"error": {
"type": "OAuthException",
"message": "(#803) Some of the aliases you requested do not exist: shahid"
}
});
</script>
This is my third week to implimenting it please guide me so I can complete this task, thanks.
FB registration page should look like as follows
Note how I mentioned server file name (it is without full URL, as both files were on same root dir) in validate_async(form, cb) function
Test02.aspx page should look like as follows
Note no html, body or head tags in test02.aspx
(Test02.aspx.cs) should look like