[jQuery] JQ mouseover keeps firing AJAX GET -- how to make it fire once?

2009-11-29 Thread TrixJo
I put my mouse over the element and my JQ .mouseover keeps firing
loading my AJAX script over and over again like a crack addict on
LSD.  How do you make it fire once?

$("#swapImage").mouseover(function(){
// get input string from the input field
var inputString = $('#swapImageValue').val();
//alert( $('#swapImageValue').val() );
// post data to our php processing page
$.ajax({
   type: "GET",
   url: "ajax_loadankleligaments.php",
   data: "mysearchString="+inputString,
   success: function(data){
if(data.length >0) {
$('#swapImage').html(data);
}
   }
 });
});


any help?


[jQuery] JQuery: Trying to make a Login Form

2009-11-28 Thread TrixJo
I realize there are lots of tutorials posted on how to make a JQ login
form.  Unfortunately none that i have googled address the two problems
I am having:

My JS Code which is in the head of my login form:

[code]
http://ajax.googleapis.com/ajax/
libs/jquery/1.3.2/jquery.min.js">

$(document).ready(function(){
$("#loginResult").hide();
$("loginForm").submit(function () {
$.post("ajax_logincheck.php", { radusername:$
('[name=radusername]').val(),radpassword:$('#radpasswordfield').val
() },
function(data){
if(data.success){
   alert(data.message);
}
process(data);
}, "json");
$("#loginResult").show("slow");
 $("#loginForm").hide("slow");
 return false;
});
});

[/code]


My login form:

[code]

Form">
username: 
password: 



[/code]

My serverside code in PHP (file "ajax_logincheck.php")

[code]
// mySQL username/password connection code omitted for obvious reasons

$radusername = htmlspecialchars($_POST['radusername'],ENT_QUOTES);
$radpassword = $_POST['radpassword'];
$radpassword=md5($radpassword);
echo 'raduser: '.$radusername .' radpass: '.$radpassword.'';
// values are blank in the above output statement

$sqlUserCheck="SELECT * FROM tbl_user WHERE username = '".
$radusername."' LIMIT 1";
echo ''.$sqlUserCheck.'';
$resultUserCheck = mysql_query($sqlUserCheck);
//if username exists
if(mysql_num_rows($resultUserCheck)>0){
$mysqlusernamecheck=mysql_result($resultUserCheck,0,"username");
$mysqlpasswordcheck=mysql_result($resultUserCheck,0,"password");
if ($radusername == $mysqlusernamecheck){
//compare the password
if(strcmp($mysqlpasswordcheck,$radpassword)==0){
//successful login, now set the session from here if needed
$_SESSION['radusername']=$mysqlusernamecheck;
// json data
$data['success']=true;
$data['redirect']= '/dashboard.php';
$data['message'] = "Your info is correct!";
}else{
// failed login due to incorrect info
$data['success'] = false;
$data['message'] = "Your info is wrong...";

}
}else{
print "Login failed! Please try again.";
}
}
[/code]

The problems I am having are two:

Problem 1: Unable to pass the username and password to the ajax file
Despite using the .post func in JS I am unable to pass the values of
the username and password to the serverside ajax file:
"ajax_logincheck.php".

You will notce that in my .post() I use two different ways to submit
the parameters:  radusername:$('[name=radusername]').val(),radpassword:
$('#radpasswordfield').val()  I have tried keeping them the same,
trading them around and nothing seems to work.


Problem 2: Form still submits oldschool even if JS is enabled
I have the form set up so that it still submits for users who don't
have JS enabled browsers.

Problem is, even though I use "return false;" in my $.post() the form
still submits and the page refreshes even though my browser has JS
enabled.

Can someone please give me advise?

thanks


[jQuery] Warning: file_get_contents error -- wtf?

2009-08-23 Thread TrixJo


Do any of you get this problem?

Warning: file_get_contents(http://search.twitter.com/search.json?
lang=en&rpp=5&q=District+9) [function.file-get-contents]: failed to
open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/site/
public_html/trendingtopics.php on line 51

It tends to appear sporadically no pattern that is obvious

Using LAMP



[jQuery] Trying to pass vars from multiple triggers

2009-08-23 Thread TrixJo

Hi I have multiple triggers and I am trying to pass variables via a
"rel=" tag (which are unique id's) for each trigger

I can get most of it working, problem is that since there are multiple
triggers with id="newsTrigger" only the first listed trigger works

Using PHP/mySQL.



An example trigger is:
while loop{
   echo ''.substr($rowNewsHeadline[$counter],0,40).'';
}

The above outputs a large number of rows with the same span id of
"newsTrigger".  When a user mousesover any of the newsTrigges I am
trying to get an ajax dialog to load up content based on the id that
is being passed through the rel tag.  How do I do this?


The javascript so far is:



$(document).ready(function(){

$("#newsTrigger").mouseover(function() {
var newsid = $(this).attr("rel");
alert(newsid);

});

});






[jQuery] Obtaining the value of an element

2009-08-23 Thread TrixJo

Hello

Using PHP to output some mySQL table data:


code:

echo ''.$row[id].'. '.$row
[topicTitle].' ';

...

...

there are 40+ rows, all with a unique $row[id]


/code

So if the user clicks the span id approveTitle I initiate an ajax
request

I want to update the row in the mySQL table that the id of the row
being clicked on is used as the id key for my table row that is being
updated

I have the JS code pasted here:

http://pastebin.com/m429218a7


A little help please?


[jQuery] Making Web Game- Need Hitpoint XP histogram/line graph

2009-01-31 Thread TrixJo

Hi there, I have been using Yahoo UI for the past couple of years and
finally jumped ship and have come over to JQuery mainly because of all
of the amazing things I am seeing!

I am making a simple web game.  Users can level their avatars and
engage in combat.

Therefore, I require a horizontal histogram for the player's health
meter and XP meter.

Stats are stored in mySQL (LAMP)

I have googled for a number of plugins and haven't been able to find a
simple one that allows for horizontal line bars for the situation I
require.

Anyone know of any?

thanks