Jump to content

iwato

Members
  • Posts

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. DILEMMA: I have a fairly complex JSON object that is introduced via an AJAX call. Unfortunately, my control panel tells me that it is undefined. Is this because it has no value? Or, is it because I do not know how to read the value properly? {"lastVisits"[{"firstVisit":{"prettyDate":"Monday, May 14, 2018"}}]} The name of the variable into which it is read is visitor_data. Am I reading the value of correctly? visitor_data.lastVisits[0].firstVisit.prettyDate Roddy
  2. OK, Team, your confusion helped me to unravel my own confusion, and I was able to achieve the task with overwhelming success. SUCCESS: The following code replaces the current content of <div id='main'> with the content of another called <div id='legal_div'>. It also propels the user to the top of the hosting div -- namely, <div id='main'> after the new content is in place. This task is achieved with a Javascript file that was imported when the old content was set. My confusion was three-fold: 1) how to select the #main div 2) where to place the Javascript, and 3) how to select the <h2> element called #data_analysis $("#make_invisible").click(function() { var replacement = $("#legal_div").html(); $("#main").html(replacement); $('body, html').animate({scrollTop: $('#main').find('#data_analysis').offset().top},800); }); In any case, the problem is now resolved. Roddy
  3. OK. Let us assume that how the content was inserted and the content itself do not matter. How does one go about replacing the content of a div from inside the div whose content is to be replaced? This should be a much easier question to understand. Roddy
  4. DILEMMA: Visitors to the mainpage of my website can fill the middle section of the page from the page's navigation bar in either of two ways. Both ways employ Javascript: one, copy a div already on the page into another div on the same page; and two, copy the contents of a div on a another page into same. What I would like to do now is to copy the contents of a div already on the page with a call from the contents of a div that was previously on another page. QUESTION: How does one get a div to replace its own content when the div whose contents needs to be replaced has been filled with content from another page? Roddy
  5. With the exception of the American public, not everyone is intentionally stupid. I try not to punish people for their ignorance. Nature will do that on its own accord. In any case, it appears that I have resolved the need for zoom by setting the minimum width of the acceptable viewport to wider than the height of the viewport of the smallest smartphone. This pretty much insures that enough of the splash panel will be made visible so that it can be easily eliminated, if it gets in the way. Roddy
  6. I still have not discovered a solution for my submit buttons. By way of example, go to the Grammar Captive mainpage, find the phrase Weekly Podcasts in the navigation bar on your left, and click. When the panel opens scroll down to the bottom of the page. Only when my phone is turned horizontal will the button at the bottom of the form appear as it should. Roddy
  7. This is cool. I did not know that you could do this. I will surely keep it in mind, as it could prove very useful down the line. I am much better at mannipulating data with PHP than I am with Javascript even when it is written in JSON. I do not know how to send POST data via a link. Is it even possible? I recall Dsonesuk teaching me how to format POST data within an AJAX call, but this is all that I can remember. Roddy
  8. Nope. I tried the following three things and refreshed the browser page of iPhone each time. 1) Placed the -webkit setting before the rule. 2) Eliminated the -webkit setting altogether. 3) With the setting eliminated introduced the suggest CSS script. All of these failed. I do believe you are correct about it having something to do with the OS's button styles. As other buttons on other filler pages are also distorted. Any suggestions about where to go to obtain more insight into the resolution of the problem. A Google search for the problem suggested the same as you.
  9. BACKGROUND: Now that I have finally got my responsive design to function properly. I did a little exploration of my site from my new iPhone 5 that a colleague gave me.to replace my broken "obsolete" iPhone 4. What I discovered was the unusual appearance of one of my form input controls. Although the submit button appears correctly on my still functioning "obsolete" MacBook, it does not appear correct on my new, not yet "obsolete" iPhone. When I investigate the matter with Firebug I am told that there is event bubbling. Now, I am not at all sure that this is the source of the problem. Neither, am I clear about how the bubbling is being created. This is the first time that I have encountered such an issue. TROUBLED DOCUMENT: 1) Open the Grammar Captive mainpage in your smartphone. 2) Find the text Weekly Podcasts under the Products subtitle in the navigation bar on your left and click on it. 3) Scroll to the bottom of the form located toward the bottom of the page and discover that the value of the button -- namely, Discover! -- is partially hidden. The width of the button is clearly not wide enough to display the entire value of the value attribute. QUESTION ONE: Why does the value attribute display correctly in my browser window on my "obsolete" MacBook, but not on my not yet "obsolete" iPhone? QUESTION TWO: If bubbling is the source of the problem, what must I do to fix it? Roddy
  10. I have found another way to achieve my task. I copied the file, changed the POST variable to GET and accessed the copied file with query statement thus circumventing AJAX. I am asking myself, however, your suggested method works. For, if I assign the contents of the curl_exec() statement to a variable. How will AJAX no where to get the variable's contents? Roddy
  11. Yes, I will do it with jQuery. I found these two rather simple jQuery methods: $(window).width() and $(window).height(). According to the jQuery manual, however these methods do not account for zoom effects. This suggests that the user could made the window much larger than the viewport and deceive my code into believing that the viewport is bigger than it is. Do you have a suggestion to get around this problem? Roddy
  12. No, I already tried that. It does not work according to the manual. AJAX likes both of the following, but neither satisfies my desire the entire outcome en gros. curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 0); curl_exec($curl_request); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1); echo curl_exec($curl_request); In order to iterate through the complex JSON object that results I must be able to see the whole thing JSON string! Roddy
  13. GREETING: One more quick question before the weekend begins. BACKGROUND: Until now, it has been easy to see the results of AJAX calls in the files that produce them. Until now, cURL was never an explicit part of my web-application. I am now making a dual call, however, and am unable to see the final result. The first call stipulates no method as nothing is sent. The second call is based on the result of the first call and uses the POST method to make the request. Although I can see the contents of the first request, I cannot see the contents of the second. Both files use identical cURL routines and both perform exactly as expected, as AJAX returns everything that is requested. Only the query statements of the URL are different. Even the specified AJAX dataType is the same for both calls -- namely, JSON. Please find below the code that produces the output that I wish to see, but cannot. The PHP for the 2ND AJAX CALL ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'error.log'); ini_set('html_errors', 0); ini_set('display_errors', 0); error_reporting(E_ALL); if (!empty($_POST['ip_addr'])) { $ip_addr = filter_var($_POST['ip_addr'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH); $url = 'https://.../matomo/index.php?module=API&action=index&visitIp=' . $ip_addr . '&idSite=1&period=week&date=today&method=Live.getVisitorProfile&format=json&expanded=0&token_auth=...'; $curl_request = curl_init(); curl_setopt($curl_request, CURLOPT_URL, $url); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, false); curl_exec($curl_request); curl_close($curl_request); } QUESTION; What must I do to make the output of the cURL call visible in the file that produces it without disrupting the AJAX call that retrieves the output that I cannot see. Or, am I missing the whole point of cURL and the data is tranferred directly to the AJAX? But, why would I be able to see it in the first request, but not the second. Roddy
  14. OK. I do not worry about the nature of the device, only the screen resolution, but how do I obtain the screen resolution? From the $_SERVER variable. I could surely obtain it from Matomo, but I do not wish to make the actual functioning of my site dependent on Matomo for anything that is not directly related to Matomo. Mind you, Colorbox is Javascript, and the contents of my splash panels are spread across many webpages. It is a complex design that is repeated many times. Unless Javascript can be triggered by an @media rule I have no idea how I would go from CSS to disabling Colorbox. Roddy
  15. The DILEMMA: Recently I discovered how to enable responsive design on my website's main page. Although the page itself is now responsive, the splash panels that are associated with it are largely dysfunctional. Having experimented in various ways to make these latter responsive as well, I have decided to simply eliminate them on mobile devices. What is the best way to do this? Already I have combined PHP and Javascript to suppress the splash panels in the same session. So, my question is what is the best way to recognize any mobile device? Roddy
  16. Problem resolved. Hooray! Hooray! Hooray! Roddy
  17. You will likely find your answer under PHP Other Services. See PHP Event. Roddy P.S. If this helps pass your cursor over the heart and click the trophy.
  18. BACKGROUND: Within two weeks of my iMac hard disk failure I also lost my iPhone due to a failed power socket. People simply do not service what Apple calls "obsolete" equipment. Although I have yet to replace my iMac, one of my colleagues had an iPhone 5 that he was no longer using and gave it to me. With his new phone in hand I went straight to the Grammar Captive website only to discover that what worked well in a device simulator does not work well at all in the real-life device. Now, my website is divided into five parts: a banner, a navigation bar, the main content section, a side bar with RSS feeds, and a footer. When the viewport is small, the aforementioned divisions are supposed to build a five tier column: banner, navigation bar, main content, side-bar, and footer. If you own an iPhone 5 compare the results for podcast_hostpage.php and with those of overview.html and see the difference. The former displays correctly, the latter does not. QUESTION: What must I do to restore the five-tier nature of overview.html? Roddy
  19. This problem has been resolved with the realization that I was viewing flexbox in MacOS 10.7.5 Firefox and Chrome environments. Fortunately, I made good use of my frustration and made the CSS code more robust by "overspecifying" the various flex-items. I do have another question about CSS, but unrelated to this one that I will post in a different entry. Roddy
  20. BACKGROUND: Recently I designed a filler page that is called with AJAX. When the AJAX call is made a css style sheet is called in addition to the filler. For the most part the style-sheet appears to work. Even the styling for the flex-box that is included in the filler works in part. Simply, it appears to be breaking on inheritance, and I do not know how to override it. The HTML <div id='yp_container'> <div class='yp_item'> <div class='yp_param'>Visitor ID:</div> <div id='current_visitorId' class='yp_value'></div> </div><!-- end div.line_item --> <div class='yp_item'> <div class='yp_param'>IP Address:</div> <div id='current_visitIp' class='yp_value'></div> </div><!-- end div.line_item --> <div class='yp_item'> <div class='yp_param'>Total Visits:</div> <div id='current_totalVisits' class='yp_value'></div> </div><!-- end div.line_item --> <div class='yp_item'> <div class='yp_param'>City:</div> <div id='current_cities' class='yp_value'></div> </div><!-- end div.line_item --> <div class='yp_item'> <div class='yp_param'>Referral URL:</div> <div id='current_referral_url' class='yp_value'></div> </div><!-- end div.line_item --> </div><!-- end div#yp_container --> CSS Style-Sheet (Relevant Code Only) /*************************************************** Visitor Info (Flexbox) ***************************************************/ #yp_container { display: -webkit-flex; display: flex; flex-direction: column; width:100%; } .yp_item { display: -webkit-flex; display: flex; flex-direction: row; justiy-content: space-between; } .yp_param { text-align: -webkit-right; text-align: -moz-right; padding-right: 2em; } .yp_value { text-align: -webkit-left; text-align: -moz-left; } You may observe the result by clicking on the words Your Profile under the sub-heading User Profile in the Grammar Captive navigation bar. Roddy
  21. OK. My host server has replied. JSG was correct. The permissions of the file in question had been set to 664, rather than 644, thus giving write permissions to group. In the discovery process I have also learned how to discover and set the file permissions on documents residing on my host server so that the problem can be easily resolved in the future. Roddy
  22. I do not know how to modify the code in the file with my browser. I can see how to modify the request headers, but this is all. In the meantime I inserted the following code between the cURL exec statement and the cURL close statement. Still nothing appeared in the error.log file. Thank you for reminding about the curl_error() statement. I had long since forgotten. The last time I used cURL outside of terminal was way back in 2010 when I was still in Thailand teaching myself PHP with the help of W3Schools. if(curl_errno($curl_request)) { echo 'Curl error: ' . curl_error($curl_request); } I have resent my initial query to my host server, as I believe it got lost in their desire to put their own house in order. Also, adding the curl_errno() and curl_error() functions reveal no new information. Apparently, nothing is able to get pass the persistent internal server error. Roddy
  23. BACKGROUND: My jubilation was short-lived. For the internal server error that was plaguing my site in general is now plaguing a crucial file in particular. Please find below a file that works perfectly well on my local test server, but fails with an internal server error on my host server. Please also note that the file matomo/index.php is located on the same server as that from which the cURL call is made, but under a different domain name. ini_set('log_errors', 1); ini_set('error_log', dirname(__FILE__) . DIRECTORY_SEPARATOR . 'error.log'); ini_set('html_errors', 0); ini_set('display_errors', 0); error_reporting(E_ALL); $url = 'https://.../matomo/index.php?module=API&method=API.getIpFromHeader&format=JSON&token_auth=...'; $curl_request = curl_init(); curl_setopt($curl_request, CURLOPT_URL, $url); curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, false); curl_exec($curl_request); curl_close($curl_request); QUESTION: Does cURL not work in such an environment? If it does, then what must I do to make it work? The error.log file contains nothing and the AJAX that made the call does not complain of not being able to access the file. Roddy
  24. The problem was resolved at approximately 5:00 PM PST. I have been dead in the water for nearly 24 hours with no explanation as to how the problem was resolved. Try the links! They are now all in good working order. I did nothing to cause the problem and everything to try and resolve it. In the end, however, I am sure that everything that I did only served as a stimulation to get others to resolve it. In the meantime I developed a round-robin AJAX call to match visitor IP addresses with those stored in the Matomo database. At least, it is a start in finding the perfect match. I will return to this problem later. As always, thank to everyone at W3Schools for your wonderful support! Roddy
  25. I have called my host server, and they said that they are working on the problem. I am now of the belief that the problem lies elsewhere, and I, and likely others, are the victims of someone else's ignorance or neglect on my shared server on the one hand, and malicious intent on the part of 3rd-party others on the other. Government corruption breeds asocial behavior, and we have no shortage of either today, as the former grows larger and larger. Roddy
×
×
  • Create New...