PWaddict Posted September 11, 2018 Posted September 11, 2018 @adrian Is it possible to view the values submitted on an ajax form and how?
adrian Posted September 11, 2018 Author Posted September 11, 2018 1 minute ago, PWaddict said: @adrian Is it possible to view the values submitted on an ajax form and how? Sure - just check out the RequestInfo panel on the AJAX bar and open up the Input POST section. Does that get you what you want?
PWaddict Posted September 11, 2018 Posted September 11, 2018 3 minutes ago, adrian said: Sure - just check out the RequestInfo panel on the AJAX bar and open up the Input POST section. Does that get you what you want? There are more than 1 bars??? How can I view the AJAX one?
adrian Posted September 11, 2018 Author Posted September 11, 2018 Just now, PWaddict said: There are more than 1 bars??? How can I view the AJAX one? The AJAX bar displays automatically when there has been an AJAX request - you can see this behavior when viewing the Page Tree in the PW admin, or triggering sub items from any of the admin menus, or any AJAX calls you make on the frontend. You should also see "Redirect" bars when there has been a redirect call. Do you not see any of these?
PWaddict Posted September 11, 2018 Posted September 11, 2018 2 minutes ago, adrian said: The AJAX bar displays automatically when there has been an AJAX request - you can see this behavior when viewing the Page Tree in the PW admin, or triggering sub items from any of the admin menus, or any AJAX calls you make on the frontend. You should also see "Redirect" bars when there has been a redirect call. Do you not see any of these? Ah yes only on backend I can see the AJAX one. On frontend I can't see it even though the entire site is based on AJAX.
adrian Posted September 11, 2018 Author Posted September 11, 2018 40 minutes ago, PWaddict said: Ah yes only on backend I can see the AJAX one. On frontend I can't see it even though the entire site is based on AJAX. Are you using a JS framework? You need to make sure the X-Requested-With header is sent so that PHP (and therefore Tracy) can recognize it as an AJAX call. jQuery does this by default, but other frameworks may not, eg Angular. In pure/vanilla JS, you can do: xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest"); In Angular you can do: $http.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; 3
PWaddict Posted September 11, 2018 Posted September 11, 2018 25 minutes ago, adrian said: Are you using a JS framework? You need to make sure the X-Requested-With header is sent so that PHP (and therefore Tracy) can recognize it as an AJAX call. jQuery does this by default, but other frameworks may not, eg Angular. In pure/vanilla JS, you can do: xmlhttp.setRequestHeader("X-Requested-With", "XMLHttpRequest"); In Angular you can do: $http.defaults.headers.common["X-Requested-With"] = "XMLHttpRequest"; I'm using JQuery and on frontend I can see the header X-Requested-With: XMLHttpRequest but there is no AJAX bar. On backend there is no X-Requested-With: XMLHttpRequest header but I can see the AJAX bar.
gmclelland Posted September 11, 2018 Posted September 11, 2018 Probably a silly question, but do you have Tracy enabled on the frontend?
adrian Posted September 11, 2018 Author Posted September 11, 2018 18 minutes ago, PWaddict said: I'm using JQuery and on frontend I can see the header X-Requested-With: XMLHttpRequest but there is no AJAX bar. On backend there is no X-Requested-With: XMLHttpRequest header but I can see the AJAX bar. Can you try this simple example in your template file: <script src="//code.jquery.com/jquery-2.1.1.min.js"></script> <script> $( document ).ready(function() { $("#ajaxButton").click(function(e) { e.preventDefault(); $.ajax({ type: "POST", url: "/data/testajax.php?test=1", data: { id: $(this).val() }, success: function(result) { console.log('ok'); }, error: function(result) { console.log('error'); } }); }); }); </script> <input id="ajaxButton" type="submit" name="testAjax" value="Test Ajax" /> This is how it looks for me: 1
PWaddict Posted September 11, 2018 Posted September 11, 2018 3 minutes ago, gmclelland said: Probably a silly question, but do you have Tracy enabled on the frontend? I haven't changed anything on module settings and yes it's enabled since I already can see the normal bar.
PWaddict Posted September 11, 2018 Posted September 11, 2018 9 minutes ago, adrian said: Can you try this simple example in your template file: <script src="//code.jquery.com/jquery-2.1.1.min.js"></script> <script> $( document ).ready(function() { $("#ajaxButton").click(function(e) { e.preventDefault(); $.ajax({ type: "POST", url: "/data/testajax.php?test=1", data: { id: $(this).val() }, success: function(result) { console.log('ok'); }, error: function(result) { console.log('error'); } }); }); }); </script> <input id="ajaxButton" type="submit" name="testAjax" value="Test Ajax" /> This is how it looks for me: I still can't see the AJAX bar. Maybe the problem is caused by localhost?
dotnetic Posted September 11, 2018 Posted September 11, 2018 Hey @adrian, is there an API to turn Mail Interceptor on, before I send emails from one of my modules? I would like to catch emails if I am on my local dev server and forgot to enable the Mail Interceptor in the Tracy Debug bar.
adrian Posted September 11, 2018 Author Posted September 11, 2018 11 minutes ago, PWaddict said: I still can't see the AJAX bar. Maybe the problem is caused by localhost? I am testing this on localhost. Actually, I think the issue is probably the contents of the php file (in my example /data/testajax.php) that is being called via ajax. I forgot to provide that to you. It needs to bootstrap PW so that Tracy is also loaded, eg: <?php include '../index.php'; Hopefully if you do that, it should work as expected.
adrian Posted September 11, 2018 Author Posted September 11, 2018 2 minutes ago, jmartsch said: Hey @adrian, is there an API to turn Mail Interceptor on, before I send emails from one of my modules? I would like to catch emails if I am on my local dev server and forgot to enable the Mail Interceptor in the Tracy Debug bar. It can be handled by the new stuff I set up recently. Have a read here: It allows you to set Tracy settings in config.php or config-dev.php (so it's local only). I think this is probably the best solution. Let me know how you find it and if you have any suggestions for improvements. PS - there is some further discussion about the instigation of this feature starting around here: https://processwire.com/talk/topic/5693-new-module-type-wiremail/?do=findComment&comment=172371 3
dotnetic Posted September 11, 2018 Posted September 11, 2018 Thanks, that is excactly what I need. Great ideas from Ivan. I had the same, but he was quicker ? 2
PWaddict Posted September 11, 2018 Posted September 11, 2018 42 minutes ago, adrian said: Can you try this simple example in your template file: <script src="//code.jquery.com/jquery-2.1.1.min.js"></script> <script> $( document ).ready(function() { $("#ajaxButton").click(function(e) { e.preventDefault(); $.ajax({ type: "POST", url: "/data/testajax.php?test=1", data: { id: $(this).val() }, success: function(result) { console.log('ok'); }, error: function(result) { console.log('error'); } }); }); }); </script> <input id="ajaxButton" type="submit" name="testAjax" value="Test Ajax" /> This is how it looks for me: This actually works. I forgot earlier to modify the url. So it seems the problem is caused from the way I ajaxified the site. Anyway, thanks for the help.
adrian Posted September 11, 2018 Author Posted September 11, 2018 4 minutes ago, PWaddict said: This actually works. I forgot earlier to modify the url. So it seems the problem is caused from the way I ajaxified the site. Anyway, thanks for the help. It should be pretty simple to figure out - if you're using jquery, then the only reason I think it wouldn't work is if you're not bootstrapping PW in the called php file. Anyway, good luck getting it sorted out.
bernhard Posted September 12, 2018 Posted September 12, 2018 Hey @adrian what do you think of adding a fullscreen button to the dump div right beside the collapse toggles? When having large dumps this could greatly improve readability and it would just need to apply a simple class with these css rules: element.style { position: fixed; left: 0; top: 0; z-index: 99999; width: 100%; height: 100%; background-color: #fff; overflow: scroll; } Then it could turn this: Into that: The collapse toggles still work. Of course we'd also need a "close fullscreen" button (or maybe ESC keyboard shortcut?) 1
adrian Posted September 12, 2018 Author Posted September 12, 2018 Hey @bernhard - I like this, but I am thinking of maybe applying it to the entire results windows, rather than a specific dump result, so it would look like this. This way you would still have fullscreen, but it makes it easier to inspect the different dumps without needing to exit fullscreen and then initiate it on another dump. Does this seem ok to you? 1
bernhard Posted September 12, 2018 Posted September 12, 2018 35 minutes ago, adrian said: Does this seem ok to you? Sure! ? Maybe - if it is easy - it would also make sense to have a fullscreen for the console code input. But that's only some ideas. Everything works great for me as it is. Just suggestions for improvements. 2
adrian Posted September 12, 2018 Author Posted September 12, 2018 New version committed that adds a Maximize button to the Console panel as a whole which results in a fullscreen editing and review experience. Thanks to @tpr for his usual tweaks to my styling :) I also added the regular fullscreen/halfscreen buttons to the Dumps and Dumps Recorder panels. These buttons are on several panels where the content can be quite large - they should have been on these panels all the time really. Let me know if you have any issues with any of this - hopefully it should make things easier to work with. 4
bernhard Posted September 13, 2018 Posted September 13, 2018 Thx Adrian! @adrian and @tpr any ideas what could be done about that AOS lang-switcher appearing on top of the panel? z-index doesn't seem to help strangely.
tpr Posted September 13, 2018 Posted September 13, 2018 Perhaps you can set a higher z-index in Tracy module's settings page, but I'll take a look when I have time.
bernhard Posted September 13, 2018 Posted September 13, 2018 Thx, the strange thing is that I've already tried a z-index of 999999999999999999999999999999999 on the panel and the language switcher still appears on top?!
tpr Posted September 13, 2018 Posted September 13, 2018 z-index is tricky, if a parent element has lower index then you can't make a child element positioned above it. I hope I can modify AOS to overcome this. 2
Recommended Posts