Jump to content

Recommended Posts

* i want to display alert message in my page where actual the form is located...

* i have 2 pages

1--> user interace page with registration form

2--> a php page called by ajax callback function to add a form data to database without redirecting from my

first page

 

now the problem is i want to display jqery alert or simple javascript alert on my first page(where actual the form) based on the result of second php page

eg:Thank u mr $name for registration.your registration id is $regid

or

eg:this username alreday exists...

 

 

this is my simple ajax call back script

----------------------------------------------

 

<script>

// wait for the DOM to be loaded

$(document).ready(function() {

// bind 'myForm' and provide a simple callback function

$('#myform').ajaxForm(function() {

 

});

});

</script>

 

 

the second page just cathces form data and generates random registartion id

eg:

 

$first_name = $_POST["first_name"];

$last_name = $_POST["last_name"];

$memberid = rand(1000000000,9999999999);

 

 

please any one help me soon to come out o this big struck...

thank you......

Link to comment
https://forums.phpfreaks.com/topic/270679-code-behind-response/
Share on other sites

there are a few ways to do this, you can either use the original jquery callback function after the ajax request has either been completed or failed, or you can just use plain simple javascript in your second page and return it in a insignificant place on the first page.

 

Also you should not use that kind of id assigning, sooner or later ids will start to repeat. Instead use the built-in auto increment in MySQL

Edited by Manixat

UUID supposedly generates a unique ID in MYSQL for a random customer ID if your goal is to give your user some sort of crazy random identifier for your users, but a primary unique identifier that auto increments is the best practice for identifying separate rows in your table. The auto_increment means that for each new entry it will receive an id of [the last id insert] + 1. You can also use that as your customer ID or try UUID to generate an additional identifier for your customers, but don't eliminate the primary unique id from the table.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.