Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #25657 > unrolled thread

can javascript post a link to a php file?

Started byrichard <noreply@example.com>
First post2014-08-08 20:15 -0400
Last post2014-08-09 08:35 -0700
Articles 8 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  can javascript post a link to a php file? richard <noreply@example.com> - 2014-08-08 20:15 -0400
    Re: can javascript post a link to a php file? Tim Streater <timstreater@greenbee.net> - 2014-08-09 08:50 +0100
      Re: can javascript post a link to a php file? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-08-09 10:44 +0200
        Re: can javascript post a link to a php file? Tim Streater <timstreater@greenbee.net> - 2014-08-09 09:52 +0100
          Re: can javascript post a link to a php file? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-08-09 11:02 +0200
        Re: can javascript post a link to a php file? richard <noreply@example.com> - 2014-08-09 09:05 -0400
          Re: can javascript post a link to a php file? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-08-09 16:12 +0200
            Re: can javascript post a link to a php file? Evan Platt <evan@theobvious.espphotography.com.invalid> - 2014-08-09 08:35 -0700

#25657 — can javascript post a link to a php file?

Fromrichard <noreply@example.com>
Date2014-08-08 20:15 -0400
Subjectcan javascript post a link to a php file?
Message-ID<cdi2zsntrsgw$.1mqa5pfr9je79$.dlg@40tude.net>
In the script for the html5 audio player I am using, there is a bit of code
that changes the active "<li>" class to "playing".
It is at this point in time I need to send a bit of information to a php
file to update the database with.
What could I use to do this with?


    <script>
      $(function() { 
        // Setup the player to autoplay the next track
        var a = audiojs.createAll({
          trackEnded: function() {
            var next = $('ol li.playing').next();
            if (!next.length) next = $('ol li').first();
            next.addClass('playing').siblings().removeClass('playing');
            audio.load($('a', next).attr('data-src'));
            audio.play();
          }
        });
        
        // Load in the first track
        var audio = a[0];
            first = $('ol a').attr('data-src');
        $('ol li').first().addClass('playing');
        audio.load(first);

        // Load in a track on click
        $('ol li').click(function(e) {
          e.preventDefault();
          $(this).addClass('playing').siblings().removeClass('playing');
          audio.load($('a', this).attr('data-src'));
          audio.play();
        });
        // Keyboard shortcuts
        $(document).keydown(function(e) {
          var unicode = e.charCode ? e.charCode : e.keyCode;
             // right arrow
          if (unicode == 39) {
            var next = $('li.playing').next();
            if (!next.length) next = $('ol li').first();
            next.click();
            // back arrow
          } else if (unicode == 37) {
            var prev = $('li.playing').prev();
            if (!prev.length) prev = $('ol li').last();
            prev.click();
            // spacebar
          } else if (unicode == 32) {
            audio.playPause();
          }
        })
      });
    </script>

[toc] | [next] | [standalone]


#25658

FromTim Streater <timstreater@greenbee.net>
Date2014-08-09 08:50 +0100
Message-ID<090820140850200399%timstreater@greenbee.net>
In reply to#25657
In article <cdi2zsntrsgw$.1mqa5pfr9je79$.dlg@40tude.net>, richard
<noreply@example.com> wrote:

> In the script for the html5 audio player I am using, there is a bit of code
> that changes the active "<li>" class to "playing".
> It is at this point in time I need to send a bit of information to a php
> file to update the database with.
> What could I use to do this with?

ajax, aka httprequest. You need to make one.

-- 
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#25659

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-08-09 10:44 +0200
Message-ID<1689703.Okl4DyZsQU@PointedEars.de>
In reply to#25658
Tim Streater wrote:

> richard wrote:
>> In the script for the html5 audio player I am using, there is a bit of
>> code that changes the active "<li>" class to "playing".
>> It is at this point in time I need to send a bit of information to a php
>> file to update the database with.
>> What could I use to do this with?
> 
> ajax,

(_AJAX_, Asynchronous JavaScript and XML) is a misnomer.  In this case, it 
does not have to be asynchronous, it does not have to be JavaScript, and it 
does not have to be XML; the request can be handled synchronously, the 
programming language can be JScript, for example, and the data format to be 
used should be JSON, if any.

> aka httprequest

is insufficient a term/hint.  The proper term and more helpful hint is 
_XMLHttpRequest_ or _XMLHTTPRequest_, commonly abbreviated XHR.

> You need to make one.

He needs (the client) to make an _HTTP request_, and can do that with XHR, 
*for example*.

He should stop abusing domains, too, see <http://example.com/>.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#25660

FromTim Streater <timstreater@greenbee.net>
Date2014-08-09 09:52 +0100
Message-ID<090820140952142993%timstreater@greenbee.net>
In reply to#25659
In article <1689703.Okl4DyZsQU@PointedEars.de>, Thomas 'PointedEars'
Lahn <PointedEars@web.de> wrote:

> Tim Streater wrote:
> 
> > richard wrote:
> >> In the script for the html5 audio player I am using, there is a bit of
> >> code that changes the active "<li>" class to "playing".
> >> It is at this point in time I need to send a bit of information to a php
> >> file to update the database with.
> >> What could I use to do this with?
> > 
> > ajax,
> 
> (_AJAX_, Asynchronous JavaScript and XML) is a misnomer.  In this case, it 
> does not have to be asynchronous, it does not have to be JavaScript, and it 
> does not have to be XML; the request can be handled synchronously, the 
> programming language can be JScript, for example, and the data format to be 
> used should be JSON, if any.
> 
> > aka httprequest
> 
> is insufficient a term/hint.  The proper term and more helpful hint is 
> _XMLHttpRequest_ or _XMLHTTPRequest_, commonly abbreviated XHR.
> 
> > You need to make one.
> 
> He needs (the client) to make an _HTTP request_, and can do that with XHR, 
> *for example*.

What I posted was plenty enough, with an intelligent bit of googling.
If he can't figure it out from that, he shouldn't be bothering at all.
This is an opportunity for him to do it all by himself.

-- 
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf

[toc] | [prev] | [next] | [standalone]


#25661

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-08-09 11:02 +0200
Message-ID<1443941.nk6EtBALqo@PointedEars.de>
In reply to#25660
Tim Streater wrote:

> In article <1689703.Okl4DyZsQU@PointedEars.de>, Thomas 'PointedEars'
> Lahn <PointedEars@web.de> wrote:

Please trim your attributions to the relevant part, as discussed in 
<news:1413630.i7XqaxqFML@PointedEars.de>, among others.

>> Tim Streater wrote:
>> > ajax,
>> […]
>> > aka httprequest
>> […]
>> > You need to make one.
>> 
>> He needs (the client) to make an _HTTP request_, and can do that with
>> XHR, *for example*.
> 
> What I posted was plenty enough, with an intelligent bit of googling.
> If he can't figure it out from that, he shouldn't be bothering at all.
> This is an opportunity for him to do it all by himself.

It may have been enough for him, but it was still wrong.

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#25662

Fromrichard <noreply@example.com>
Date2014-08-09 09:05 -0400
Message-ID<1vzy6maeqhhp9$.1eg7vtym3kk1w.dlg@40tude.net>
In reply to#25659
On Sat, 09 Aug 2014 10:44:01 +0200, Thomas 'PointedEars' Lahn wrote:

> Tim Streater wrote:
> 
>> richard wrote:
>>> In the script for the html5 audio player I am using, there is a bit of
>>> code that changes the active "<li>" class to "playing".
>>> It is at this point in time I need to send a bit of information to a php
>>> file to update the database with.
>>> What could I use to do this with?
>> 
>> ajax,
> 
> (_AJAX_, Asynchronous JavaScript and XML) is a misnomer.  In this case, it 
> does not have to be asynchronous, it does not have to be JavaScript, and it 
> does not have to be XML; the request can be handled synchronously, the 
> programming language can be JScript, for example, and the data format to be 
> used should be JSON, if any.
> 
>> aka httprequest
> 
> is insufficient a term/hint.  The proper term and more helpful hint is 
> _XMLHttpRequest_ or _XMLHTTPRequest_, commonly abbreviated XHR.
> 
>> You need to make one.
> 
> He needs (the client) to make an _HTTP request_, and can do that with XHR, 
> *for example*.
> 
> He should stop abusing domains, too, see <http://example.com/>.

example.com is setup for use in documents with no permission needed.
The home page used to have a statement saying that people could use the
domain in usenet addy's at will.
Know what you're talking about before getting your ass kicked.

The other addy I used for years member@newsguy.com, was used with
permission.
As any emails to it were simply discarded.

[toc] | [prev] | [next] | [standalone]


#25666

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2014-08-09 16:12 +0200
Message-ID<1490588.nsim8CW4x3@PointedEars.de>
In reply to#25662
richard wrote:

> On Sat, 09 Aug 2014 10:44:01 +0200, Thomas 'PointedEars' Lahn wrote:
>> He should stop abusing domains, too, see <http://example.com/>.
> 
> example.com is setup for use in documents with no permission needed.

That is oversimplifying the matter.

> The home page used to have a statement saying that people could use the
> domain in usenet addy's at will.

It does not have such a statement now and it never had.  Usenet postings are 
_not_ “examples in documentation”.  RFC 2606 is very specific about the use 
of those domains, so is that Web site.  Your use of that domain is actually 
network *abuse*.

> Know what you're talking about before getting your ass kicked.

You should heed your own advice.

> As any emails to it were simply discarded.

That is anti-social and generally unwise.  Private e-mail (PM) is an 
important feedback channel on Usenet.  You would fare better there if you 
did not block it in advance.

How strange that you did not refer to the other, much larger part of my 
posting, in which I gave relevant relevant technical advice (to you).

-- 
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

[toc] | [prev] | [next] | [standalone]


#25667

FromEvan Platt <evan@theobvious.espphotography.com.invalid>
Date2014-08-09 08:35 -0700
Message-ID<7sfcu9tq5p67stu64o15q3vmofkfd2stp2@4ax.com>
In reply to#25666
On Sat, 09 Aug 2014 16:12:30 +0200, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:

>How strange that you did not refer to the other, much larger part of my 
>posting, in which I gave relevant relevant technical advice (to you).

Of course. How often has bullis been known to say "Thank you" in all
the thousands (millions?) of times he's been given free help?
-- 
To reply via e-mail, remove The Obvious and .invalid from my e-mail address.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web