Jump to content
MakeWebGames

Sim

Members
  • Posts

    2,392
  • Joined

  • Last visited

  • Days Won

    62

Everything posted by Sim

  1. Cause you got smarter and realized it was debugging? 🙂
  2. Sim

    jQuery round 4.. :)

    i wish I could use the code tags Edit: my markup is correct. Phone auto corrected it. <div id="scavageResults"></div>
  3. I load my page with some of my previous jQuery code. The new page I load some new HTML: Partial HTML: <div I'd="scavageResults"></div> The JavaScript that is loaded is: var scavageTimer; var counter; var scavageData; var scavageCounter; function performScavage(){ //e.preventDefault(); var timez = jq("#scavageTimes").val(); var url = "?page=scavage&times=" + timez; alert(timez); if(timez <= 0) { alert("You have to search the streets at least one time!"); return false; } jq.get(url, function(scavageData) { alert(scavageData); scavageCounter = 0; alert(1); setTimeout('showScavageResults()', 1000); }); } function showScavageResults(){ alert(2); jq("#scavageResults").append(scavageData[scavageCounter].msg); scavageCounter++; } The problem is it never appends my scavageData. I think it's not showScavageResults. All my other alerts get down. scavageData returned is:
  4. Worked for me @Veramis
  5. "since the form was not submitted using a button". The form does getting submitted using a button. Now I get to pick on yo for giving me wrong URL:
  6. So the forms with buttons seem to go unregonized by the modules. <button type="submit" name="submit" value="true" class="btn">Update</button> The Ajax: jq("#php__container").on('submit', 'form', function(e){ e.preventDefault(); alert(jq(this).serialize()); var url = jq(this).attr("action"); jq.ajax({ type: "POST", url: url, data: jq(this).serialize(), success: function(data) { alert(data); jq("#php__container").html(data); // show response from the php script. } }); return false; }); $this->methodData->submit will always be empty. Every other fo element will have it's value. Anyone got any ideas on what's going on?
  7. Edit: deleted old code in this post. This works. jq("#php__container").on('submit', 'form', function(e){ e.preventDefault(); var url = jq(this).attr("action"); alert(url); return false; }); Problem being that all GL forms action URLs are ="" so, I can't submit the forms to the right URL as of now. I can do a session thing. Anyone know away to make the back button work on jQuery pages?
  8. So now that I got all pages with links to load in my content area, my next hurdle is the forms. I can't get the code to LMK when a form is being submitted . I can't bind it upon loading page since the forms will be loaded at a later time. So I tried to bind any form that is inside php__container. There's definitely a bunch of people here that seems like they know more about this then me. var jq = $.noConflict(); jq(document).ready(function() { jq("#php__container > form").submit(function(){ alert("form"); e.preventDefault(); }); jq('a').on('click', function(e) { var url = jq(this).attr('href'); if(url.includes("?")) { e.preventDefault(); jq("#php__container").load(url); } }); jq('#php__container').click(function(e){ if (jq(e.target).is('a')) { e.preventDefault(); var url = e.target.href; jq("#php__container").load(url); //alert(url); } }); // update_stats(); });
  9. Lol, thanks. I can't believe I overlooked that.
  10. Aight, I have gotten it to work to some extent. Once my content gets loaded into the php__cointaner div, I can get the link recognized with this new code. I watch it load the new content inside the div, then it redirects :(. So.. preventDefault isn't working properly. var jq = $.noConflict(); jq(document).ready(function() { jq('a').on('click', function(e) { var url = jq(this).attr('href'); if(url.includes("?")) { e.preventDefault(); jq("#php__container").load(url); } }); jq('#php__container').click(function(e){ if (jq(e.target).is('a')) { e.preventDefault; var url = e.target.href; jq("#php__container").load(url); //alert(url); } }); // update_stats(); });
  11. There is no errors in the code what so ever. I click a link, it loads my NEW PAGE WITH LINKS using Ajax. The NEW LINKS that APPEAR on the NEW LOADED content don't load with Ajax. My guess is, the JavaScript code is not binded(terminology?) to the new content loaded? Edit: edited main post to fix vvvv things and removed commented code.
  12. My code spacing is correct before I post it in here. #2 the vvvvvs was correct JS before posted here. It read URL.includes The unnecessary it's will be removed over done texting. BUT most importantly you mentioned everything but anything regarding the question at hand
  13. So I needed to turn every URL on my page into a jQuery/Ajax link (WHICH PARTIALLY WORKS). Every link works except for any new links(ones that get loaded from my Ajax call). So say I load ?page=crimes It will load perfectly in my php__cointainer. But now when the module HTML loads. Say the crimes, yo click the commit button URL ex: ?page=crimes&action=commit&crime=1 The Ajax no longer works. It loads a fresh page. var jq = $.noConflict(); jq(document).ready(function() { jq('a').on('click', function(e) { var url = jq(this).attr('href'); if(url.includes("?")) { e.preventDefault(); alert(url); jq("#php__container").load(url); } else { alert ("no url"); } }); update_stats(); });
  14. VueJS. A JS engine for game?
  15. Sim

    jQuery

    What is the AAAAAA
  16. Sim

    jQuery

    There was no error. Why it had me fooled for a minute. And it was after the jQuery.
  17. Sim

    jQuery

    I don't see why it doesn't load the content. The alert displays the correct URL. So unsure what exactly yo mean HTML: <div class="php__container" id="#php__container"> <div class="tab-pane" id="topnav-tab2" role="tabpanel"> <ul class="php__links nav nav-justified"> <li class="nav-item"><a class="nav-link" href="characters.html">Character</a></li> <li class="nav-item"><a class="nav-link" href="inventory.html">Inventory</a></li> <li class="nav-item"><a class="nav-link" href="battle.html">Battle</a></li> <li class="nav-item"><a class="nav-link" href="upgrade.html">Upgrade</a></li> </ul> </div> JavaScript: $(document).ready(function() { $('.php__links > li > a').click(function(e) { e.preventDefault(); alert($(this).attr('href')); $("#php__container").load($(this).attr('href')); }); }); I got it figured out. I included my JavaScript after my css file 🙂 I included it in the wrong spot somewhere. 🙂
  18. Sim

    jQuery

    What exactly do to mean?
  19. Sim

    jQuery

    Anyone, both issues (this and other post) I have are stopping my development of anything right now?
  20. If I'm not mistaken GL has its own constructor for mods: public $helper = null; public function constructModule() { include "class/ItemHelperFunctions.php"; $this->helper = new ItemHelperFunctions(); $this->method_view(); } Now the issue rises: All my methods I had to include in my helper class $this->getSelectedItem(); becomes $this->helper->getSelectedItem (); But the real issue is on 2 of the 6 mods it doesn't work. $helper remains NULL(doesn't assign). Anyone got a solution? Or know the problem? I even tried using the regular constructor but the problem remains the same on 2 of the 6 mods. It's got me a bit confused. Error: Uncaught Error: Call to a member function getSelectedItem() on null in /home/simmakew/public_html/GL/modules/installed/blackMarket/blackMarket.inc.php:357 Stack trace: #0 Edit: The constructors in any GL module following @Dayoformat is broke. Using the method constructModule is not called first UNLESS ANOTHER METHOD IS NOT CALLED . To fix this issue Open: class/module.PHP Find: if ($this->construct) { $this->constructModule(); } MOVE BEFORE: if (isset($this->methodData->action)) { $methodAction = 'method_'.$this->methodData->action; if (method_exists($this, $methodAction)) { $this->$methodAction(); } } Now I am not %100 sure why function __construct() Does not keep the globals from module PHP. The globals, $page, $db, $user no longer work. $this->page, $this->DB, $this->user By my fix above handles all issues I have mentioned. Error: Uncaught Error: Call to a member function prepare() on null in
  21. Sim

    BootSrap 5

    Although I am not a front end developer: https://www.infoworld.com/article/3563416/bootstrap-50-alpha-arrives-sans-jquery.amp.html
  22. No, 2 seperate instances.
  23. I started cleaning up the code with a ItemHelperFunction class. I done removed over 1,000 lines of code across all files into less then 200 lines in the function class For fun: I also broke the item slots ACP and can't get it to work again(same code from item types ACP but produces two different results).
  24. I have 2 instances of GL installed in different sub-directories on my server. I just realized when I login one of them, I am logged in both of them. If I logout of one of them, I get logged out of both of them. I am unsure if my login credentials are the same on both games, but regardless I shouldn't be logged in or out of both. @Dayo
  25. Describe what React DOM frontend and JWT authentication is ? :0
×
×
  • Create New...