Solved

How can I prevent my page from reloading after the "alert?"

Posted on 2014-04-16
2
153 Views
Last Modified: 2014-04-17
Here's my code:

$workqueueroleassigncheck = cer_workqueueroleassigncheck($tmp_entity[$i]["entityid"], $EntityID, $tmp_user[$k]["userid"]);
					if($workqueueroleassigncheck["count"]>0)
					{
					print '<script type="text/javascript">'; 
					print 'alert("be careful not to assign a role to the same person twice...!")'; 
					print '</script>';  
					}
					else
					{
					$workqueueroleassignsave = cer_workqueueentityassignsave($tmp_role[$j]["roleid"],$tmp_entity[$i]["entityid"],$EntityID, $tmp_user[$k]["userid"], $updateuserid);
					}

Open in new window


Basically, if the user attempts to add a record that's a duplicate of what's already in place, they get an alert and the insert code doesn't fire.

Problem is, I don't want the page to reload. Is there a way to structure my code where the checkboxes that had been checked remain so rather than the page reloading?
0
Comment
Question by:brucegust
2 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40005316
What web framework are you using? PHP? ASP/ASP.NET? Other?

If ASP.NET, do you have your controls set to auto-postback?
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 40005420
That's PHP and to prevent it from reloading, you would have to call it with AJAX instead of posting to it.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now