Solved

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

Posted on 2014-04-16
2
161 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
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…

749 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