473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Problems with window.location in confirm box

i have created a code which post a uid to a different server on confirm dialog click and on button click it works fine the code below

for confirm box:

Expand|Select|Wrap|Line Numbers
  1. function andpop()
  2. {
  3. var qes   = confirm( " " );
  4. if ( qes )
  5. clicked( '1135' );
  6. }
  7.  
Button:
Expand|Select|Wrap|Line Numbers
  1. input type="button" value="click" onClick="return clicked('1135');">
  2.  
but i also want to redirect to another page when i click confirm or button,so i changed the code with

confirm box:
Expand|Select|Wrap|Line Numbers
  1. function andpop()
  2. {
  3. var qes   = confirm( " " );
  4. if ( qes )
  5. window.location ="buf";
  6. clicked( '1135' );
  7. }
  8.  
Button:
Expand|Select|Wrap|Line Numbers
  1. <a href="www.google.com"><input type="button" value="click" onClick="return clicked('1135');"></a>
  2.  
but now its not working it showing error

the code using for posting data:
Expand|Select|Wrap|Line Numbers
  1.         function clicked( uid ) {
  2.         $.ajax({
  3.             url:    'http://example.com/jquery/member/count.php',
  4.             type: 'GET',
  5.             data:   'uid='+uid,
  6.             dataType:   'jsonp',
  7.             jsonp:  false,
  8.             jsonpCallback:  'methodCallback',
  9.             success: function( data ) {
  10.                 if( data.message == "yes" ) {
  11.                     alert("d");
  12.                 } else {
  13.                     alert( "failed, maybe uid its not exists in database" );
  14.                 }
  15.  
  16.  
  17.             },
  18.             error: function( Request, error ) {
  19.                 alert( error );
  20.             }
  21.         });
  22.     }
  23.  
  24.  
Jun 9 '13 #1
1 1360
Rabbit
12,516 Expert Mod 8TB
I don't understand the purpose of the AJAX call if you're going to redirect the user before the AJAX call.
Jun 10 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: K. S. | last post by:
hi guys, this code works fine in IE but doesnot work in opera. the page just reloads to test.html# in opera. can anyone help? thanks. ...
5
by: spam_me_ not | last post by:
I already understand that one cannot disable a browser's forward and back functions. This is a situation where I have code working in Mozilla V1.6 and would like something similar for Opera and...
3
by: saiho.yuen | last post by:
Hi, Is anyone know what is the difference between Location.href and Window.location.href Thanks you very much:) Saiho
2
by: Craig Keightley | last post by:
I have a very simple confirm link on a website using the following code: function confirmNewSupplier(){ if(confirm(' Are you sure that you can\'t select a supplier from the list? ...
18
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
4
by: Jeff Paffett | last post by:
I'm writing a file manager application using Ajax techniques and the client wants to be able to bookmark file searches. I send the search request to a remote server using a XMLHttpRequest and then...
3
iam_clint
by: iam_clint | last post by:
My turn to finally ask for help function checkval(page, mfg) { var chk = document.getElementsByName("partscheck"); var val = false; var val2 = false; for (i=0; i<=chk.length-1; i++) { ...
1
by: empiresolutions | last post by:
The following JS script works fine in FF and IE7. It fails though in IE6, which happens to be my target audience. Whats failing is.. the window.location is not calling. function...
4
by: MarkKM | last post by:
Hello, I'm having troubles with IE7 and the window.location function in an SVG file. This all works fine in IE6 using the Adobe SVG viewer but not in IE7, WHY? Please HELP! We use IE in Kiosk...
6
mikewagan
by: mikewagan | last post by:
hello guys, Javascript's been bugging on IE, and i'm trying to search for a solution for this answer but no luck. I have a select box as a navigation element. If a user clicks on an option, it...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.