Skip to content

Tag: javascript

jQuery not working when I echo it from PHP

I need only some js to run during some parts of a php script, for testing purposes I commented out the php so I am not going to show it here. The line I have labeled 1B works fine, the background image displays. The section labeled not working seems to have no effect but when I run it separately in

onclick not loading iframe

Here is the JS I am using This is in the head of the document. I have made a sidebar containing links: I have a target frame as: It works when I click the top level link, Sales in my case, the relevant document gets displayed in the target frame, but as soon I navigate to submenu links, its get

Download a file with an ajax call

I am using PHPExcel to read an excel template, populate the data, and ask the user to download the file. generate_excel.php When I open generate_excel.php directly from the browser, the result file is downloaded. But if I make an ajax call to the generate_excel.php, I don’t get the download prompt. Usin…

Detect user exit site

I have an urge to detect when a user leaves my site in order to record accurately the session length of the user in question. I have thought of a couple possible solutions for this: I first thought I could use onbeforeunload and send a simple ajax to record the last activity but what practice has shown me is …