0

Hi,
I am new in ajax.
I am using a calender in javascript.& also using ajax code for form validation n submission.
but calender is not working if i use ajax
Need suggestions.

<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="requirement_validation.js"></script>
<script type="text/javascript">jQuery(document).ready(function($) {$('a[rel*=facebox]').facebox() })</script>

<link rel="stylesheet" media="screen" href="styles/vlaCal-v2.1.css" type="text/css" />
<script type="text/javascript" src="jslib/mootools-1.2-core-compressed.js"></script>
<script type="text/javascript" src="jslib/vlaCal-v2.1-compressed.js"></script>

<script type="text/javascript">
$(function() {

function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\]?$)/i);
return pattern.test(emailAddress);
};
$(document).ready(function()
{ 

	$("#username").blur(function()
	{
		//remove all the class add the messagebox classes and start fading
		$("#msgbox").removeClass().addClass('messagebox').text('Checking...').fadeIn("slow");
		//check the username exists or not from ajax
		$.post("user_availability.php",{ username:$(this).val() } ,function(data)
        {
		  if(data=='no') //if username not avaiable
		  {
		  	$("#msgbox").fadeTo(200,0.1,function() //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('This email Already exists').addClass('messageboxerror').fadeTo(900,1);
			  $("#password").attr("disabled", "disabled");
			  $("#rpassword").attr("disabled", "disabled");
			  $("#mobile").attr("disabled", "disabled");
			  $("#city").attr("disabled", "disabled");
			  $("#name").attr("disabled", "disabled");
			  $("#type").attr("disabled", "disabled");
			});		
          }
		  else
		  {
		  	$("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
			{ 
			  //add message and change the class of the box and start fading
			  $(this).html('Email available to register').addClass('messageboxok').fadeTo(1000,1);
			});
		  }
				
        });
 
	});
});

$(".submit").click(function() {

    var name = $("#name").val();
	var username = $("#username").val();
	var password = $("#password").val();
	var type = $("#type").val();
	var mobile=	$("#mobile").val();
	var city=$("#city").val();
	var rpassword=$("#rpassword").val();
    var dataString = 'name='+ name + '&username=' + username + '&password=' + password + '&rpassword=' + rpassword+ '&type=' + type + '&mobile=' + mobile + '&city=' + city;
	if(name=='' || username=='' || password=='' || rpassword=='' || type=='' || city=='' || mobile=='')
	{
	$('.success').fadeOut(200).hide();
    $('.error').fadeOut(200).show();
    $('.pwd_error').fadeOut(200).hide();
    $('.error1').fadeOut(200).hide();
    $('#msgbox').fadeOut(200).hide();
    $("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
	{ 
	  //add message and change the class of the box and start fading
	  $(this).html('Email available to register').addClass('messageboxok').fadeTo(1000,1).hide();
	});
	}
	
	else if( !isValidEmailAddress(username) ) 
	  { 
	   $('.success').fadeOut(200).hide();
       $('.error').fadeOut(200).hide();
       $('.error1').fadeOut(200).show();
       $('.pwd_error').fadeOut(200).hide();
       $('#msgbox').fadeOut(200).hide();
       $("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
	{ 
	  //add message and change the class of the box and start fading
	  $(this).html('Email available to register').addClass('messageboxok').fadeTo(1000,1).hide();
	});
	  }
	  
	else if(!(password==rpassword))
	{
	 $('.success').fadeOut(200).hide();
     $('.error').fadeOut(200).hide();
     $('.pwd_error').fadeOut(200).show();
     $('.error1').fadeOut(200).hide();
     $('#msgbox').fadeOut(200).hide();
  	$("#msgbox").fadeTo(200,0.1,function()  //start fading the messagebox
	{ 
	  //add message and change the class of the box and start fading
	  $(this).html('Email available to register').addClass('messageboxok').fadeTo(1000,1).hide();
	});

	}
	else
	{
	$.ajax({
	type:"POST",
    url:"join.php",
    data:dataString,
    success: function(){
	$('.success').fadeIn(200).show();
    $('.error').fadeOut(200).hide();
    $('.pwd_error').fadeOut(200).hide();
    $('.error1').fadeOut(200).hide();
    $('#msgbox').fadeOut(200).hide();

    $('#name').val('');
    $('#type').val('');
    $('#password').val('');
    $('#rpassword').val('');
    $('#username').val('');
    $('#mobile').val('');
    $('#city').val('');
		
   }
});

	}
		
    return false;
	});

});
</script>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by stbuchok
0

It could be because you are using 2 different JavaScript Libraries.

http://docs.jquery.com/Using_jQuery_with_Other_Libraries

You will need to figure out what code is using what library and rewrite it accordingly.

Also, could you provide a proper explanation as to what is going wrong? Saying, "Something isn't working", without giving an explanation or error messages makes it harder to figure out.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.