Current location: Hot Scripts Forums » Programming Languages » ASP.NET » Jquery + ASP.NET.Crucial!!!!!


Jquery + ASP.NET.Crucial!!!!!

Reply
  #1 (permalink)  
Old 07-17-08, 02:43 PM
highjo highjo is offline
Newbie Coder
 
Join Date: May 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Jquery + ASP.NET.Crucial!!!!!

hello!
i'm developing a application with jquery and php before i refactor to c# for several reason. working with jquery is cool but i have a code that runs in php perfectly and not working here.It's an ajax call to validate a well formed phone number.here is briefly the codes.
this is from default.aspx i removed the ready and the trigger
HTML Code:
$.ajax({
			                    type:"POST",
			                    url:"DestinationChecker.aspx",
			                    data:"number="+n,
			                    success:function(msg){
				                    if(msg)
				                    {
					                    alert(msg);
					                   $('#valid').append("<div id='vall'>"+n+"</div>");
				                    }
	                                else            			           
				                    {
					                    alert(msg);
					                    $('#valid').append("<div id='err'>"+n+"</div>");
				                    }
					            }
		                    });
this is the destinationchecker.aspx
HTML Code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DestinationChecker.aspx.cs" Inherits="DestinationChecker" %>
this is it's page behind
PHP Code:

using System;

using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;

public 
partial class DestinationChecker System.Web.UI.Page
{
    protected 
void Page_Load(object senderEventArgs e)
    {
        
//string _smsuser = ConfigurationManager.AppSettings["user"];
        //string _smspass = ConfigurationManager.AppSettings["password"];
        //string _api_id = ConfigurationManager.AppSettings["api_id"];
        //SmsGateway cobj = new SmsGateway();
       
        
string number Request["number"];
        
number number.Trim();
        if(
number.Length != 0)
        {
           
//bool res = cobj.destination(number, _api_id, _smspass, _smsuser);
            
bool res this.checker(number);
    
            
Response.Write(res);
        }
    }
    public 
bool checker(string testNumber)
    {
        
Regex patterns = new Regex(@"^([1-9]{1}\d{8,15})$");
        
Match m patterns.Match(testNumber);
        return 
m.Success;
    }

onlyn this part got executed
Quote:
if(msg)
{
alert(msg);
$('#valid').append("<div id='vall'>"+n+"</div>");
}
not matter the result.true or false
i'm sure i'm missing something but can't see it.please i need your experience on this thank you
Reply With Quote
  #2 (permalink)  
Old 07-18-08, 05:24 AM
highjo highjo is offline
Newbie Coder
 
Join Date: May 2007
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
no replies? not even one?
Reply With Quote
  #3 (permalink)  
Old 07-18-08, 09:37 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Bumping your thread 3 times in 2 hours isn't gonna get your faster responses either.

And why are you using C# for the validation? Javascript can handle regular expressions too.
Reply With Quote
  #4 (permalink)  
Old 07-20-08, 11:07 PM
ervinter ervinter is offline
New Member
 
Join Date: Jul 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Maybe you can return integer value instead of bool value. Just try and see.

Last edited by Nico; 07-21-08 at 02:34 AM. Reason: Removed personal URL.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
jQuery UI Tabs + Lightbox Hunter JavaScript 2 07-12-08 03:52 AM
jQuery ready states cancer10 JavaScript 2 07-02-08 03:35 PM
Ajax and jQUERY cancer10 JavaScript 1 06-25-08 12:56 AM
Mootools, JQuery, prototype, scriptaculous? Keyne JavaScript 10 06-16-08 07:10 AM
Upload with jQuery janick JavaScript 3 03-24-08 07:06 AM


All times are GMT -5. The time now is 02:40 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.