1

I was reading this sentence and was a bit confused because it has two possible meanings:

But I want to terminate the session as soon as user closes the browser using Ajax.
          — Source (scroll down to second reply)

Does he mean that he wants to close the browser by using Ajax,

or that he wants to terminate the session by using Ajax?

Is the sentence grammatically incorrect, or is it my mistake that I see more than one meaning? How could I rewrite the sentence to make it obvious?

  • 1
    In terms of English the sentence is definitely ambiguous as @SGR has pointed out. As a programmer I would say that the meaning is almost certainly "I want to use Ajax to terminate the session as soon as the user closes the browser." (He should probably be using the beforeunload event.) – Hugh Meyers Apr 12 '16 at 8:35
  • 1
    Thanks for adding the source. This makes it clear that the interpretation in my previous comment is correct. Using javascript (the "ja" part of Ajax) he wants to detect when the user tries to close the browser and send a message to the server that it the session can be terminated. As I guessed, he is indeed using the beforeunload event. Note that "as soon as" is not quite technically correct. The Ajax message must be sent before the browser closes. – Hugh Meyers Apr 12 '16 at 9:29
2

As you surmise, it is ambiguous.

The best solution to rewriting the sentence is to make the use of Ajax explicit, with "use Ajax to..."

But I want to terminate the session as soon as user uses Ajax to close the browser.

But I want to use Ajax to terminate the session as soon as user closes the browser.

Unless it is the session or the browser which is using Ajax, and any action is independent of that. In that case, use which:

But I want to terminate the session as soon as user closes the browser which is using Ajax.

But I want to terminate the session which is using Ajax as soon as user closes the browser.

Not all of those unambiguous versions make technical sense, but they are unambiguous.

2

The phrasing is ambiguous.

I believe the author intended to say that he wanted to terminate the session when a browser using Ajax was closed. So, a sentence such as this leaves no room for confusion:

But I want to terminate the session as soon as [a/the] browser using Ajax is closed by the user

However, if did intend to say that he wanted to terminate the session using Ajax, then a phrase such as this would be more clear:

But as soon as the user closes [a/the] browser, I want to terminate the session by using Ajax

0
But I want to terminate the session as soon as user closes the browser using Ajax.

It's not your mistake, the sentence is a mess.

I find a third possible meaning, where "using" might be a participle instead of a verb: he wants to terminate the server-side session after the client browser (which runs client-side Ajax) closes.

  • 1
    If using is not a verb here, what is it? – Lawrence Apr 12 '16 at 8:42
  • A participle, or as some call it, an adjective phrase. Edited answer accordingly. Thanks, @Lawrence. – agc Apr 12 '16 at 9:03
  • I feel as if I'm asking a dumb question, but if we take using to be part of an adjective phrase, wouldn't we end up with a browser-using Ajax? I.e. the thing the user is said to close is then the Ajax, in particular, the one that uses a browser. – Lawrence Apr 12 '16 at 9:10
  • Good question. Andrew Leach found four meanings of the '...using Ajax' sentence, his #4 seems close to what you mention. The correct meaning doesn't emerge by order, but by context and accent. "Arrest all the Martians using rayguns." is sort of vague. "Arrest all the raygun using Martians." is clear. – agc Apr 12 '16 at 10:23
  • There's more :) - try reading the sentence with soon as the username. This results in at least two more interpretations depending on how you then read the following as. – Lawrence Apr 12 '16 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.