[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

can javascript post a link to a php file?

William Gill

8/9/2014 12:16:00 AM

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>
9 Answers

The Starmaker

4/20/2014 2:08:00 AM

0

The Starmaker wrote:
>
> Jens Stuckelberger wrote:
> >
> > On Sat, 19 Apr 2014 11:03:49 -0700, The Starmaker wrote:
> >
> > > Isn't that true? Is that correct? Isn't that accurate?
> >
> > It's true: you are stoned. By the way, it is "capital letter",
> > not "capitol letter", you ignorant.
>
> Isn't it the orher way around, Stuckelberger? Aren't you the ignorant one...at least you're showing your
> ignorance to everyone else..
>
> when the fact is, the first pictures sent to aliens from here was of a naked woman.
>
> You talk like you got a burgerStuckelupyourbutt.



The aliens from outer space are going to be very disapointed when they get here and see
all these girls with clothes on!

They are gonna say, "Hey! Where are those naked girls like the picture you sent us????


The President is going to have to tell his wife..."Take off your clothes!"


You people send a picture of a naked girl to outerspace, and you gotta deliver the goods.


Otherwise they're going to say, "Show me yours and I'll show you mines".


When the flying saucer arrives, there is going to be a naked girl in that saucer.


I mean, really...why did you guys sent a naked picture of a girl to outer space????


Do you think those guys are interested in what our women look like???


I was wondering what was the 'logic' behind that?


What are you going to do when the aliens from outer space arrive, take them to a strip club?

Tim Streater

8/9/2014 7:50:00 AM

0

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

Thomas 'PointedEars' Lahn

8/9/2014 8:44:00 AM

0

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://exampl....

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

Tim Streater

8/9/2014 8:52:00 AM

0

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

Thomas 'PointedEars' Lahn

8/9/2014 9:02:00 AM

0

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.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

William Gill

8/9/2014 1:05:00 PM

0

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://exampl....

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.

Thomas 'PointedEars' Lahn

8/9/2014 2:07:00 PM

0

richard wrote:

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

That is oversimplying 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.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Thomas 'PointedEars' Lahn

8/9/2014 2:13:00 PM

0

richard wrote:

> On Sat, 09 Aug 2014 10:44:01 +0200, Thomas 'PointedEars' Lahn wrote:
>> He should stop abusing domains, too, see <http://exampl....
>
> 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.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not Cc: me. / Bitte keine Kopien per E-Mail.

Evan Platt

8/9/2014 3:35:00 PM

0

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.