Asked  7 Months ago    Answers:  5   Viewed   36 times

I am calling a php script over ajax to do some database maintenance. If the user closes the page, hits back, or clicks a link, will the php script be fully executed? Is there a way to do it?

Maybe if the php script called the exec() method or something similar, which would in turn call a script via the console as such:

$ php /var/www/httpdocs/maintenance.php




As long as the user agent (browser, etc.) has fully sent the request, the server has all it needs and will complete the request and try to send back a response.

In fact, this sort of "pinging" behavior is often used for "heartbeat"-like processes that keep a service warm or perform periodic maintenance.

Wednesday, March 31, 2021
answered 7 Months ago

dataType - delete this one.

Add console.log and open console in Your browser

success: function (data) {
   console.log( data );

show Your console, and then You will see why. Maybe an unwanted char or php error

Second thing - there should be if stament like this (I supposed)

if (data == "1") // it is returning string, not integer.

You can also try to use switch case in success.

Wednesday, March 31, 2021
answered 7 Months ago

add target=_blank in your ajax success function like below

success: function(){'http://YOUR_URL','_blank' );

otherwise you can handle smartly to open your Excel download link in new tab with jQuery trigger function or etc.

Monday, July 19, 2021
answered 4 Months ago

The most specific selector takes precedence. This is mentioned in CSS2.1:

Pseudo-elements behave just like real elements in CSS with the exceptions described below and elsewhere.

In terms of actual browser behavior, as far as I know, this behavior is reliable on all browsers that support :before and :after on non-replaced elements like a, for which CSS2.1 does define behavior for those pseudo-elements, unlike replaced elements like img. This makes sense, because if more than one such pseudo-element were to be generated, the browser wouldn't know how it should lay them out in the formatting structure.

In the following example, by specificity and the cascade, a.inactive:before will take precedence and the :before pseudo-element for this link will have the matching content (since both selectors are equally specific — having a type selector, a class selector and a pseudo-element):

a.administrator:before {
    content: '[Administrator] ';

a.inactive:before {
    content: '[Inactive User] ';
<a class="administrator inactive" href="profile.php?userid=123">Username</a>

If an element can match more than one selector with the same pseudo-element, and you want all of them to apply somehow, you will need to create additional CSS rules with combined selectors so that you can specify exactly what the browser should do in those cases. Extending the above example:

a.administrator:before {
    content: '[Administrator] ';

a.inactive:before {
    content: '[Inactive User] ';

a.administrator.inactive:before {
    content: '[Administrator] [Inactive User] ';
<a class="administrator inactive" href="profile.php?userid=123">Username</a>
Wednesday, August 4, 2021
answered 3 Months ago

Then the server doesn't send gzip. That's the whole point of the "Accept-Encoding:" heading from the browser, which indicates this by not having "gzip" in that header.

Friday, August 27, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :