all AI news
Email ID and website URL validations in your jQuery
April 25, 2024, 2:12 a.m. | Gurpinder Singh
DEV Community dev.to
To implement email and website URL validations in your jQuery code, you can use regular expressions to check the format of the email address and the URL. Here's how you can modify your code to include these validations:
$.ajax({
url: base_url + "index.php?v=1",
type: 'post',
data: $('#loginfm').serialize(),
success: function(data) {
// Parse the response data if needed
// var data = JSON.parse(data);
// Validate email address using regular expression
var emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
var email = $('#email').val();
if (!emailRegex.test(email)) { …
ajax beginners check code data email format function index javascript jquery php programming success type url webdev website
More from dev.to / DEV Community
Jobs in AI, ML, Big Data
Founding AI Engineer, Agents
@ Occam AI | New York
AI Engineer Intern, Agents
@ Occam AI | US
AI Research Scientist
@ Vara | Berlin, Germany and Remote
Data Architect
@ University of Texas at Austin | Austin, TX
Data ETL Engineer
@ University of Texas at Austin | Austin, TX
Lead GNSS Data Scientist
@ Lurra Systems | Melbourne