Jump to content

Shadowing

Members
  • Posts

    722
  • Joined

  • Last visited

Everything posted by Shadowing

  1. says its expecting a bracket } line 27 which is line success(response) { maybe i should use FF and download this thing called fire bug i hear so much about to see java script errors better I dont understand the syntax at all when "success" starts. cause for how im reading it its following parameters. So is that suppose to be part of the data parameter or a new one
  2. I'm getting hit with a script error on just displaying the index page before even clicking on the link. is there something im doing wrong? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script type="text/javascript" src="/system_lords/jquery/jquery-1.7.1.min.js"></script> <script> $(document).ready(function() { $("#linky").click(function() { $.ajax({ url: 'foo.php', type: 'POST', dataType: json, data: { msg_from_js: 'Hello from jQuery' }, success(response) { $('#foo').html(response.msg); } }); }); }); </script> </head> <body> <a href="#" id="linky">Click</a> <div id="foo"></div> </body> </html>
  3. ahh i totally skiped over .ajax cause of the way jquery.com has their browsing catagory set up.. i clicked on global ajax event handlers instead which isnt at the begining lol. Thanks for the examples thorpe will try it out.
  4. yah im using jquery I read that post before posting, its just to much code. need something more simplier. i was reading ajax for jquery but couldnt find any tutor examples for it at jquery.com. i'll go look again.
  5. Hey guys i just started trying out ajax and my knowledge of java script is still really low. Im trying to test to make sure im even grabing the php file. So i want to return something so i know its working. so i put this div tag with some words on the file "include_evaluate.php" <div id="myDiv"> Ajax is working </div> So when i click the button with the id evaluate i want it to display "Ajax is working". so i dont know what i need to add to this to make it return whats in the div. <script> $(document).ready(function(){ $("#evaluate").click(function(event){ xmlhttp.open("GET","\System_Lords\ajax\include_evaluate.php",true); xmlhttp.send(); document.getElementById("myDiv").innerHTML=xmlhttp.responseText; }); }); </script>
  6. well for this situation i can do this to make it work <?php require("../header.php"); ?>
  7. oh maybe i just cant use that when looking for files that are in the same folder. I dont understand why it would try to search in the guide folder with that link
  8. that fixes all my link issues but when I use that on a required file I get this error. says i need to include the c:? Warning: require(/system_lords/header.php) [function.require]: failed to open stream: No such file or directory in C:\Software\XAMPP\xampp\htdocs\System_Lords\Guide\guide.php on line 18 Fatal error: require() [function.require]: Failed opening required './system_lords/header.php' (include_path='.;C:\Software\XAMPP\xampp\php\PEAR') in C:\Software\XAMPP\xampp\htdocs\System_Lords\Guide\guide.php on line 18
  9. ahh thanks. that solves everything. cause yah i was wondering about that issue when i put my site on the web.
  10. hey guys Using IE8 i can do this <img src="c:/software/xampp/xampp/htdocs/system_lords/images/26hicon.gif" alt="26h icon" width="40" height="40" /> but in firefox it doesnt work. any ideas? It shows the alt though just not the image.
  11. There is a game called lord of ultima http://www.lordofultima.com/en/ and I notice when you open up a window its fixed. So maybe they are just using CSS box then. I'm not even sure if they are even using CSS/java script/AJAX to do this game. I just assumed. but what else is there. I know they are using .net for the sever side language.
  12. Hey guys been looking through what can be done with java script and I was wondering how to make it where a new window opens up and when the window opens up the user cant move the window out side the current browser window. Acctually im wanting to make it where they cant move the window at all. Is this done with window object? Im having problems finding the right keywords on googling this. Like to know what im trying to do and what its called so i can google detail help for it.
  13. my query is running off of a SESSION that gets changed according to what is selected. So I guess the only way i can make this work is if the page reads the planet from the link instead of using Session then? that makes sense since java script is read after php. I have some thinking to do then, not sure i want to use $_GET for this.
  14. thanks for the reply redsmurph in this case it changes the planet a person is viewing. queries some information and sets it as a Session so when selection changes $planets3 = "SELECT address FROM planets WHERE name ='".mysql_real_escape_string($_POST['siege_list'])."'"; $planets2 = mysql_query($planets3) or die(mysql_error()); $planets1 = mysql_fetch_array($planets2); $_SESSION['planet'] = $planet1['address']; so i dont know how to make java script fire the php code
  15. Hey guys I wasnt sure if this is a php topic or java script im trying to make my drop down menu's activate onchange. what confuses me is how do I make php know that the java script is being run. Or have the java script trip my php code. To know a button has been pressed i use "if (isset['_POST'])" echo '<select name="siege_list" id="siege_list">'; foreach($name as $key => $value) { echo '<option value="' . $value['name'] . '" ' . ($value['name'] == $current1 ['name'] ? 'selected="selected"' : '') . '> ' . $value['name'] . '</options>'; } echo '</select><input type="submit" id="siege_planet" onchange="this.form.submit()">';
  16. thank you thorpe. whats a better way of doing it? or maybe something i can read. Id like to have better technique. one thing i hate is when i started learning all this stuff that i started out building on poor foundations on how im writing.
  17. I notice if I try to hit enter and split a long string up with java script i get a error. onmouseover="popup('<img src="images/planets/<?php echo $picture; ?>.jpg"/> <?php echo planet_pop_up($detail_name,$stargate_address,$detail_owner); ?>');"> then i have a function being inserted into the code above "planet_pop_up" the function has this string in it. $details = "<h4>$detail_name</h4><br /><br /><br /><p>Owner: $detail_owner</p>"; This string is going to get really long cause im going to be adding to it. If i try to bring some of it onto a new line i get a java script error. "Unterminated string constant" like this below $details = "<h4>$detail_name</h4><br /><br /><br /> <p>Owner: $detail_owner</p>"; anyone know what I need to do to to so i can use more then one line lol.
  18. I have a link with a rel attached to it that activates a java script and for some reason it wont let me use a document on the link. using dominion.php wont activate the java script but http://google.com does. The java script is a snippet i got online. doesnt make any sense why it would matter. What the script does is it makes a a picture appear on mouse hover over the link. <p><a href="http://google.com" rel="imgtip[1]">Link 2</a></p> <p><a href="dominion.php" rel="imgtip[0]">The D</a></p> var ddimgtooltip={ tiparray:function(){ var tooltips=[] //define each tooltip below: tooltip[inc]=['path_to_image', 'optional desc', optional_CSS_object] //For desc parameter, backslash any special characters inside your text such as apotrophes ('). Example: "I\'m the king of the world" //For CSS object, follow the syntax: {property1:"cssvalue1", property2:"cssvalue2", etc} tooltips[0]=["1.GIF", "Here is a red balloon<br /> on a white background", {background:"black", color:"#E0E0E0", border:"5px ridge darkblue"}] tooltips[1]=["1.GIF", "Here is a red balloon<br /> on a white background", {background:"black", color:"#E0E0E0", border:"5px ridge darkblue"}] return tooltips //do not remove/change this line }(), tooltipoffsets: [20, -30], //additional x and y offset from mouse cursor for tooltips //***** NO NEED TO EDIT BEYOND HERE tipprefix: 'imgtip', //tooltip ID prefixes createtip:function($, tipid, tipinfo){ if ($('#'+tipid).length==0){ //if this tooltip doesn't exist yet return $('<div id="' + tipid + '" class="ddimgtooltip" />').html( '<div style="text-align:center"><img src="' + tipinfo[0] + '" /></div>' + ((tipinfo[1])? '<div style="text-align:left; margin-top:5px">'+tipinfo[1]+'</div>' : '') ) .css(tipinfo[2] || {}) .appendTo(document.body) } return null }, positiontooltip:function($, $tooltip, e){ var x=e.pageX+this.tooltipoffsets[0], y=e.pageY+this.tooltipoffsets[1] var tipw=$tooltip.outerWidth(), tiph=$tooltip.outerHeight(), x=(x+tipw>$(document).scrollLeft()+$(window).width())? x-tipw-(ddimgtooltip.tooltipoffsets[0]*2) : x y=(y+tiph>$(document).scrollTop()+$(window).height())? $(document).scrollTop()+$(window).height()-tiph-10 : y $tooltip.css({left:x, top:y}) }, showbox:function($, $tooltip, e){ $tooltip.show() this.positiontooltip($, $tooltip, e) }, hidebox:function($, $tooltip){ $tooltip.hide() }, init:function(targetselector){ jQuery(document).ready(function($){ var tiparray=ddimgtooltip.tiparray var $targets=$(targetselector) if ($targets.length==0) return var tipids=[] $targets.each(function(){ var $target=$(this) $target.attr('rel').match(/\[(\d+)\]/) //match d of attribute rel="imgtip[d]" var tipsuffix=parseInt(RegExp.$1) //get d as integer var tipid=this._tipid=ddimgtooltip.tipprefix+tipsuffix //construct this tip's ID value and remember it var $tooltip=ddimgtooltip.createtip($, tipid, tiparray[tipsuffix]) $target.mouseenter(function(e){ var $tooltip=$("#"+this._tipid) ddimgtooltip.showbox($, $tooltip, e) }) $target.mouseleave(function(e){ var $tooltip=$("#"+this._tipid) ddimgtooltip.hidebox($, $tooltip) }) $target.mousemove(function(e){ var $tooltip=$("#"+this._tipid) ddimgtooltip.positiontooltip($, $tooltip, e) }) if ($tooltip){ //add mouseenter to this tooltip (only if event hasn't already been added) $tooltip.mouseenter(function(){ ddimgtooltip.hidebox($, $(this)) }) } }) }) //end dom ready } } //ddimgtooltip.init("targetElementSelector") ddimgtooltip.init("*[rel^=imgtip]")
  19. Ahh figured out my issue. The page i was making edits on wasnt even part of the page i was testing it on if i had it wraped in a function i wouldnt of had this issue
  20. Well im confused lol. using NOW and using UTC_TIMESTAMP is giving me the same time, which is server time. and server time is -6. im wanting 0 so its the same as strtotime anyone know what im doing wrong.
  21. Yah i just assumed NOW was gmt so i need to go look up on how to make it record the time stamp in 0 GMT then. I didnt think once to check the time of the time stamp cause I thought it was a format issue lol. where it couldnt read it
  22. thanks for the responce requinix Im recording the Time stamp with NOW. I figure that is 0 GMT. Thought strtotime was the same. UPDATE users SET last_active = NOW() but yah im displaying everyone and showing which ones are online and which ones are offline. the query in my question is already is grabing the people online from with in the last 5 minutes. Sorry for the confusion on what im trying to do.
  23. Hey guys, im having a slight issue with comparing mysql time stamp. I'm using the timestamp in mysql to show how many people are online with in 5 minutes. $sql = mysql_query("SELECT name,id FROM users WHERE DATE_SUB(NOW(), INTERVAL 5 MINUTE) <= last_active ORDER BY id ASC"); But I want to grab last_active from the data base and compare it like below. I dont know if strtotime just doesnt compare with mysql time stamp or what? if($last_active > strtotime('-5 minutes')) { echo "<td>Online</td>"; }else{ echo "<td>Offline</td>"; }
  24. I figured out my issue, also I just realized what selecting input as radio does lol. Which is actually more of what I wanted.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.