JQuery :: Posting To A Php Page - Unable To Use A Conditional Statement With One Of The Variables?
Nov 11, 2011
I am posting two variables to a php page:
$.post('poll_receiveData.php', {question:currentSlide, vote:vote},
function(output){ ... })
}
currentSlide is set to 0. vote is set to 2. When I look at my console log, these are true. But in poll_receiveData.php, I'm unable to use a conditional statement with $vote. It's like the program doesn't know how to compare things to $vote. But a SQL statement using $question works just fine. Here's my code:
[Code]...
View 1 Replies
ADVERTISEMENT
Apr 13, 2010
I am not a javascripter however I have a simple need to a yes no question before someone can fill out a form. Bloew is what I have. If they click yes I'll take them to the form, if no then I will redirect them to a different page. I can not get it to work.
Code:
View 2 Replies
View Related
Dec 28, 2010
I'm trying to write a modal login script which I borrowed from the SimpleModal site. Unfortunately, I'm running into a very frustrating problem.
When the user types in a valid login/password combo, the PHP function do-login.php echos back "OK". That being said, here's a snippet of my jQuery code:
$.ajax({
type: "POST",
url: "do-login.php",
data: str,
[Code].....
The do-login.php script DOES echo back "OK"- I verified that with Firebug. But even though it echos back "OK", it goes to the 'else' clause.
I tried using return instead of echo but that didn't help either.
View 18 Replies
View Related
Jun 18, 2010
So I'm new to jQuery and loving it! I just got stuck on a problem that I'm not sure how to work around. I'm trying to add a class to a li item in a navigation if it has child list items underneath it. For example,if I have this situation:
[Code]...
View 1 Replies
View Related
Mar 8, 2011
JQuery and I have a function which adds an image to a link depending on the file type.
How to write a statement that says....if there is no file extension - leave the default styling, if not add file extension. At the moment I have dots and images..see here [url]
View 8 Replies
View Related
May 3, 2011
Code? What is the correct way to write it.
Rules: create an array for the user to type 5 strings in a prompt that will be displayed in an alert box.
User must type in the prompt an alert will display what the user typed if the prompt is empty or contains nothing an alert will display telling the user to enter text user clicks ok on the alert box and is sent back to the prompt box
View 14 Replies
View Related
Dec 6, 2009
Code:
Red part in the code above is for conditional statement.
But the conditional statement doesn't work correctly.
How can I make the conditional statement correct in javascript?
View 24 Replies
View Related
Feb 20, 2010
I am starting to learn javascript and I had a quick question. I know actionscript and java, so this my mistake here is probably context...but I cant seem to figure it out. I'm trying to figure out how to create a conditional statement based on what button a user clicks. Here's my code:
[Code]....
This doesn't seem to work. Am I referencing this.value incorrectly? If so, what's the proper way to get information about what the user clicked?
View 4 Replies
View Related
Nov 21, 2006
I have a table with dynamic html that contains drop down select lists
and readonly text boxes. Dynamic calculations are done on change of a
value in one of the drop down select lists.
For my first iteration the script works fine ( indicating that there
are 33 form variables ). When trying another dropdown select value, the
form elements.length is shown as 33 ( as about ) BUT the script then
crashes with a 'null value' error. I cannot access any of the form
variables - this works in all other browsers and platforms.
View 2 Replies
View Related
Jun 20, 2011
I found this script for a navigation fade-in/fade-out and I want to modify it so it'll only trigger the fade-in/fade-out functions of the span class is NOT set to active. Here is the javascript:
Code:
$(function() {
$("#nav ul#menu li span.active").css("opacity","1");
$("#nav ul#menu li span.active").hover("opacity","1");[code].....
It's the part of the code beneath the comment CONDITIONALS BELOW that I want to be able to only trigger it if span is not set to class .active.
View 1 Replies
View Related
Feb 11, 2011
I am totally new to javascript..
1. I am taking data by opening text file from the server using javascript XMLHttpRequest
2. Using that, i am planning to plot data....
In the following code , i am setting global variable inside for loop .
[Code]...
View 1 Replies
View Related
Apr 10, 2011
I am using ajax in my site and want to implement a friend request button. When a user clicks this button their userid and the userid of the friend thwey are requesting will go into a table called notifications in my mysql database. This works fine in regular html/php with javascript disabled but not when using javascript/ajax.
Here's my code which may clarify things:-
Code:
<script type="text/javascript">
function makeRequest(friendrequestloggedinuserid, friendrequestuserid)
{
if (window.XMLHttpRequest)
[Code]....
The above code works perfect if javascript is disabled and the button is clicked as the new row is inserted into the database however if javascript is enabled the alert shows inidicating the ajax file is working but the new row is not inserted. Is this something to do with the POST process between my javascript code and my ajax_processrequests.php file?
BTW $loggedinuserid and $userid are retrieved earlier on in my code but showing how they are retrieved is irrelevant to this because I know they are present at the point of the above code.
View 2 Replies
View Related
Oct 19, 2010
I'm trying to code a script that will display an approximate postage price based on different combinations of variables, but the numbers I defined for each case aren't reflected in the text box. I'm using a switch statement for all the different combinations of options, which the user will choose by selecting check-boxes. (Additionally, I know that this code probably isn't a very efficient way of doing what I'm doing - how to improve it.) I've attached all the relevant parts of the code, including how I defined variables originally.
<script type="text/javascript">
function count(){
var firstclass = document.calc.firstclass.value;
var postcard = document.calc.firstclass.value;
var numpages = document.calc.numpages.value;
var nms = document.calc.nms.value;
var large = document.calc.large.value;
var numpages = parseInt(document.calc.numpages.value); .....
View 6 Replies
View Related
Apr 11, 2010
I have a jQuery script which shows a specified div based on the select chosen from the dropdown list.The problem im having is how to retain the div state after the page has been posted and then returned too,
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
[code]....
View 5 Replies
View Related
Jun 8, 2005
In javascript, I want to do run a script based on the contents of a page. My page called page.php either contains only a 1 or is totally blank, and I want, from another page, to query the contents of that page in the form of an if, then, else statement. Code:
View 1 Replies
View Related
Nov 11, 2002
What coding would I use to post some data when the page is loaded rather than posting through clicking a button or link? I've searched around but I can't find it...
View 2 Replies
View Related
Jul 1, 2010
I've made the following script:
$(document).ready(function(){
var showHide = $.cookie('menuStatus');
alert(showHide);
/* Part that dosn´t work.
if (showHide==closed) {
$("#menu").hide();
}
*/
$(".openClose").click(
function(){
$("#menu").slideToggle("slow", function() {
if ($(this).is(':hidden')) {
//var state = "closed";
$.cookie('menuStatus', 'closed');
} else if ($(this).is(':visible')) {
//var state = "open";
$.cookie('menuStatus', 'open');
}
//alert(state);
});
});
Now this is the example: [URL]. When page loads, you get an alert, with the var showHide, which should be open or closed. Problem is the if statement. I must say it was exciting to make this little script with jQuery. Especially setting the cookie, I couldn't have done it without the jQuery plugin. As you can see I tried to set a variable first but when page reloads, the variable was reset.
View 2 Replies
View Related
Aug 1, 2009
I bind a custom event on page A,then ajax load page B。In page Bthereis a <a> link which trigger the custom event.Problem is :the trigger function work when i place the trigger
function in page A ,but not work in B by ajax load.
View 1 Replies
View Related
Mar 9, 2011
I'm trying to load google.com from a test html page using jQuery-1.5.1 but unable to do it.I've tried all the 3 methods listed but to no success.Below is the code snippet for the same & the output that I'm getting.
CODE:
<html>
<head>
[code]....
View 1 Replies
View Related
Feb 24, 2011
I would like to be able to access the raw CSS code that has been loaded for the specific page. I'm not looking to change the code (I know how to use jQuery for CSS manipulation etc...) I just want to parse through it and extract some useful information.I considered just loading the stylesheet references in the page, then placing a request to the server for the .css file, but this feels messy even if the browser happens to have the page cached from having just requested it.Has anyone got a clue as to how one would go about this? As always, I think its best if it uses jQuery XD, however, I just really want to get this done
View 2 Replies
View Related
Aug 10, 2010
when reloading a page containing some jquery code based variables (which are: a variety of datepickers with set dates, and a number of form textfields containing calculated and formatted monetary values) it appears that those variables remain set. If I set a variable on the page (in a form field) then refresh the page I would like for everything to be cleared out (start with a clean slate). I work around this by setting standard values to all those fields and datepickers manually, but I would rather avoid that and clear all variables/set values, rather than assigning a value to all those fields and datepickers manually to remove previous usage traces of the page. I want the refresh to behave like a full reload. I read somewhere that loading jquery with a variable at the end of the url string would achieve that. While I know how to o that, I would rather use just jquery and make sure cache / variables are cleared each time the page is loaded. My main reason for that is I'd like users to take advantagef of google APIs (so they use a cached jQuery version, for faster page loading).
an example of the page (with manual workaround in the code) can be seen at [URL] I work around the issue by using
$(function(){//clear all numbers on refresh or new pageload.
$("input.nbr").val("0,00");
});
View 1 Replies
View Related
Feb 15, 2012
I have javascript which counts seperately every time 2 seperate buttons are clicked, this then outputs the amount on the same page. This works, however I am now trying to add a third value to output on the page which is the total of the clicks which i would calculate by adding the 2 attributes together. This just doesn't seem to be working though.
java
<script type="text/javascript">
var NextClick = 0;
var PrevClick = 0;
var TotalClicks = 0;
[Code]....
View 1 Replies
View Related
Aug 4, 2009
I am not able to submit the page details in IE 6 since am getting Javascript error: "unknown name" while submitting the page. If i press submit button for second time getting javascript error "Permission Denied". I tried to submit the details in IE 7 aswell the same error occurs.But i tried to submit the page in FireFox, its worked great... submitted without any error and the details saved in the database.
View 4 Replies
View Related
Apr 14, 2009
i have a form input box but dont need to be able to POST the output on the next page, it works if i dont have it marked as disabled.
View 1 Replies
View Related
Jul 14, 2009
Many time i am getting one problem with Jquery when i am using more then one jquery plugin on same page then only one plugin works which will be on top. I guess few variables mixing and disturbing to each other. I just want to know is there any way to control it?
View 9 Replies
View Related
May 8, 2007
The main page of the site has this script which determines the
language settings of the OS. This works fine for IE but not for
firefox. Is there any other codes which i have to insert to make sure
Firefox would be able to load it?
<script type="text/javascript">
function detectlang()
{
var lang=navigator.userLanguage
var langs=navigator.systemLanguage
var langb=navigator.browserLanguage
if
((langs=="ar-sa"||lang=="ar-sa"||langb=="ar-sa"))
{window.location.reload("http://www.flynas.com/ara/index.html")}
else
{window.location.reload("http://www.flynas.com/eng/index.html")}
}
</script>
View 4 Replies
View Related