Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

jQuery code not working without alert function

jQuery jquery

  • Please log in to reply
3 replies to this topic

#1 datalogi

datalogi

    CC Lurker

  • Just Joined
  • Pip
  • 6 posts

Posted 27 December 2011 - 06:16 AM

Hi,

I can't get the following jQuery code working without putting alert() function before $.get()

Could you please help me?

Code:
function hae_kommentoitava_teksti_erinomainen() {

randomNum = Math.ceil(Math.random()*10000000);

// alert();

$.get("hae_teksti.php?ID="+ID+"&randomNum="+randomNum, function(data){

var StringInArray = data.split('|');


if(typeof StringInArray[1] == 'undefined')
{
$(".question6").hide();
$(".question7").hide("slide", { direction: "left" }, 1000);
$.doTimeout( 'someid', 1500, function(){
$(".question8").show("slide", { direction: "up" }, 1000);
});
var tarkistuskoodi = 7;
hae_kommentoitava_teksti_kehityskelpoinen(tarkistuskoodi);
}

else
{
$('.kommentoitava_idea').html(StringInArray[0]);
idean_numero = StringInArray[1];

$(".question6").hide();
$(".question7").hide("slide", { direction: "left" }, 1000);
$.doTimeout( 'someid', 1500, function(){
$(".question7").show("slide", { direction: "up" }, 1000);
});
}
});
}
  • 0

#2 Vaielab

Vaielab

    Programming God

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1382 posts
  • Location:Quebec City
  • Programming Language:Java, C++, C#, PHP, JavaScript, Visual Basic .NET, Transact-SQL, ActionScript

Posted 27 December 2011 - 09:47 AM

Are you waiting for jquery to be completely loaded?

put your code inside this

$(function () {
//Code goes here
});

  • 0

#3 datalogi

datalogi

    CC Lurker

  • Just Joined
  • Pip
  • 6 posts

Posted 27 December 2011 - 10:06 PM

Yeah, my code is already inside it.

Despite of that it's not working...
  • 0

#4 Vaielab

Vaielab

    Programming God

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1382 posts
  • Location:Quebec City
  • Programming Language:Java, C++, C#, PHP, JavaScript, Visual Basic .NET, Transact-SQL, ActionScript

Posted 28 December 2011 - 09:57 AM

If your code is already inside this, it mean, we don't have all your code, and so make it hard to help you... we can only guess
And my only other guess, is that jquery is loaded, but maybe not jqueryUI.
With firefox & firebug, in the net console, do you see the get request?
  • 0





Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download