Jump to content

Shadowing

Members
  • Posts

    222
  • Joined

  • Last visited

Everything posted by Shadowing

  1. thanks for the reply. I decided to just use seperate divs hehe. I have another question though that is driving me crazy. If i place a input field on the screen after page load. Do i need to use live or something in order to grab its value with $('#production_tech').val()
  2. oh maybe its because it remembers it was clicked? so the click activates each time
  3. Hey guys im having a wierd issue I have a ajax working menu that when you click on each item in the menu a div pops up. I'm trying to have each menu item use the same div. So this is pretty much what each menu item has. what happends is when I click on "li.planets" the div appears with its content and then I click "#close" and it clears the div makes it blank but for some reason when i click on "li.planets" again to show the div its blank instead of reloading the content. for my understanding using html should replace content every time right? $("li.planets").click(function(event) { $("div.child_window").show(0); $("a#close").click(function(event) { $("div.child_window").hide(0); $('div.child_window_content').html(""); $('div.child_window_menu').html(""); }); }); $("div.child_option1").click(function(event) { $.ajax({ url: "ajax/menu_planets.php?functions=planets_owned", type: 'POST', success: function(response) { $('div.child_window_content').html(response.display); } }); });
  4. if i did place something on top of everything and made it transparent. im assuming this is what you mean? would that also keep me from interacting with elements under it? like clicking or what ever. which wouldnt be what id want. im pretty sure if you log into www.lordofultima.com/ you cant hight light stuff on the map. i'll check that again. but I know the game Utopia does it where you cant select. but they are also have no need to interact with elements. I wanted to do this cause idk it just feels better when clicking around on the page
  5. Hey guys I notice some sites/games have it where you cant double click on the screen and high light stuff. Was wondering how they do that? I notice google doesnt do this but gives a example of what I dont want.
  6. Shadowing

    scopes

    that error control works, nice! just tested it. also i should mention the error doesnt go off in the above example
  7. Shadowing

    scopes

    thats wierd i changedvar details = (response.details); to details = (response.details); and now now it says undefine error but then when i activate it the 2nd time the alert workswith putting alert only out side the success bracket. oh thats awesome error control im going to use that. maybe not that long of a error thoughso like do i just put that error control anywhere does it not matter in what order?i'll put the name of the function in the error message
  8. Shadowing

    scopes

    that was a interesting theory went back and replicated the first exampleand the php script wasnt failing at that time. I even went a step further and checked the variable msg and address after success bracket both values existedalso i went ahead on the php file and made it where it didnt need the address variable passing onto it. function popup(msg, address, width){var msg; $.ajax({ url: "/ajax/map.php?functions=popup", type: 'POST', dataType: 'json', data: { address: address }, success: function(response) { var details = (response.details); msg = msg+details; alert(details); // this works } }); alert(details); // this doesnt work if (ready) { if (typeof width === "undefined"){ width = default_width; } $('#pup').html(msg).width(width).show(); var t = getTarget(arguments.callee.caller.arguments[0]); $(t).unbind('mouseout').bind('mouseout', function(e){ $('#pup').hide().width(default_width); } ); } }
  9. Shadowing

    scopes

    oh you are right the php page was failing. I forgot it needed the address variable :)alert is working now out side the success bracket.so some how it must of been failing earlier to then.i was changing so much stuff hard to tell. I think im going to go ahead and try to duplicate by going back add this all to that orginal function in my orginal post and see if i can add details to msg now. $(function(){$.ajax({ url: "/ajax/map.php?functions=popup", type: 'POST', dataType: 'json', async: false, data: { address: '210235' }, success: function(response) { details = "test"; }}); alert(details); });
  10. OMG!!! it works now. that makes sense onclick only assigns its self to stuff on page load. Geez thank you so much, this is much better way of doing things. going to try to see if i can make it work with the onmouseover function im using instead of using onmouseover need to find out jqueries subsitute for using onmouseover
  11. geez no idea why i cant read the html that is being inserting with ajax onto my page.I problem solved it down to a dead end road lol. This sucks to cause this new method is so much better. i have java script function "arrows" on the page excuting the function from a external java script page that is linked in the header of the page. <script type="text/javascript" src="<?php echo LPATH; ?>jquery/map.js"></script> // this contains arrows function arrows(); // activating the arrows function arrows does a ajax call and inserts link/image onto the page $map_array .= "<a class='whatever' href='project.php'><img src='images/star.jpg' ></a>"; inserts it into the div with the class name "map" $('div.map').html(response.display_stars); and this below thinks that the image/link with the class name "whatever" doesnt exist $(".whatever").click(function(event) { event.preventDefault(); planet_details($(this).attr("id")); }); function planet_details(address){$.ajax({ url: "/ajax/map.php?functions=popup", type: 'POST', dataType: 'json', data: { address: address }, success: function(response) { $('.planet_info').html(response.details); }});} any ideas on what i can do to help problem solve this? Firebug shows it existingthis is driving me insane. real important i figure this one out. This will change how i do things in the future EDIT: posted this before reading your reply
  12. Shadowing

    scopes

    details is not defineddid a copy and paste of the code i used. this way you know im using exactly what i tried. $(function(){$.ajax({ url: "/ajax/map.php?functions=popup", type: 'POST', dataType: 'json', async: false, success: function(response) { details = "$test"; }}); alert(details); }); if I do this i get no undefine errors but the alert box does not pop up. $(function(){$.ajax({ url: "/ajax/map.php?functions=popup", type: 'POST', dataType: 'json', async: false, success: function(response) { details = "$test"; alert(details); }}); });
  13. On the bright side. the code works other then that lol Oh i just realized something lol I see what this line is doing now planet_details($(this).attr("id")); I didnt notice the 2nd set of () lolso you are calling the function there and passing the variable at once my bad lol Alright so now i just have to figure out why i cant read html being placed on the page with an ajax script
  14. when i put the html directly on the page it works so the problem is caused from ajax placing the html on the page and for some reason jquery cant read it. the jquery code is directly on the page and placed after the function that places the images on the page
  15. Alright I attempted this route. I dont understand this line of code below. planet_details($(this).attr("id")); im grabing the number I assigned to the id right? so I need it to be a variable so i can pass it through the planet_details function anyways i couldnt get this to pop the alert up wierdive used click a ton of times with no issues <img id='$address' class='whatever' onmouseover='popup(\"$picture\")' src='images/star.jpg'> $(function(){$(".whatever").click(function(event) { event.preventDefault(); alert("working"); });});
  16. yah someone mention this to me before but I didnt know how to turn the id into a variable like you just did above oh so i give all links the same class name? then if any of the links with that class name is click it grags the id from that link? I'll try this out, cause yah this would be way better specially for future projects that will be much more advance maps.
  17. Shadowing

    scopes

    I ran this exact code copy and pasted it. and firebut says details is undefinedif you can read this and i cant what the heck lol its a onmouseover pop up box function I got from someone. Its the only code in my entire site I didnt write my self lolmy javascript is so bad $(function(){ $.ajax({ url: "/ajax/map.php?functions=popup", type: 'POST', dataType: 'json', data: { }, success: function(response) { details = "$test"; }}); alert(details); });
  18. Yah you are right thats whats going on. I changed it to onclick instead and using image tag only and it works. anychance you can show me how you would write the false statement on the line
  19. oh do i need to some how add in the statement you said like inline after onfocus? hmm never wrote javascript in a line like that before not sure how to do it
  20. thanks for the reply Ingolme you mean like this $("#"+address).click(function() { //event.preventDefault();return false;}); shouldnt this still work though? just onfocus with alert <a id='210235' onfocus='alert("onfocus is working")' href='' >test</a>
  21. I added the alert function instead and the alert works on FF,IE and opera but not chrome. so onfocus isnt working hmm. <a id='210235' href='' onfocus='alert("onfocus is working")'>test</a>
  22. Hey guys im having issues getting this to work in chrome. It works in opera,IE8 and firefox Im not sure if its the onfocus thats not working or the preventdefaultnot sure how to problem solve it to figure out which to help narrow it down whats happening is when the link is clicked it refreshes the page <a id='210235' href='' onfocus='planet_details(210235)'>test</a> function planet_details(address){ $("a#"+address).click(function(event) { event.preventDefault();$.ajax({ url: "/ajax/map.php?functions=popup", type: 'POST', dataType: 'json', data: { address: address }, success: function(response) { $('.planet_info').html(response.details); }});});}
  23. Shadowing

    scopes

    using jquery version 1.7.2 Yah alert works with details inside the success bracket.what happends if you run this code dsonsuk. do you get details undefined? $(function(){ $.ajax({ url: "/ajax/map.php?functions=popup", type: 'POST', dataType: 'json', data: { }, success: function(response) { details = "$test"; }}); alert(deatils); }
  24. Shadowing

    scopes

    i did alert inside the success bracket for details using details = (response); and it gave me object object, so i guess it needs the key. So i tried thisdetails = "testing"; and put alert again in the same spot above if(ready) and got undefine
  25. Shadowing

    scopes

    if i add a alert before If(ready) i get details is undefined success: function(response) { details = (response.details); msg += details; } }); alert(details); if (ready) {
×
×
  • Create New...