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


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

Can I test ajax if I don't have any database or any server. I just run local

Started by"Tony Johansson" <johansson.andersson@telia.com>
First post2015-03-01 00:20 +0100
Last post2015-03-02 10:14 +0000
Articles 9 — 7 participants

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


Contents

  Can I test ajax if I don't have any database or any server. I just run local "Tony Johansson" <johansson.andersson@telia.com> - 2015-03-01 00:20 +0100
    Re: Can I test ajax if I don't have any database or any server. I just run local Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-03-01 02:52 +0100
    Re: Can I test ajax if I don't have any database or any server. I just run local "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2015-02-28 20:05 -0800
    Re: Can I test ajax if I don't have any database or any server. I just run local Tim Streater <timstreater@greenbee.net> - 2015-03-01 09:15 +0000
    Re: Can I test ajax if I don't have any database or any server. I just run local JJ <jj4public@vfemail.net> - 2015-03-01 18:36 +0700
    Re: Can I test ajax if I don't have any database or any server. I just run local Denis McMahon <denismfmcmahon@gmail.com> - 2015-03-01 14:22 +0000
      Re: Can I test ajax if I don't have any database or any server. I just run local "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-01 16:04 +0100
      Re: Can I test ajax if I don't have any database or any server. I just run local Tim Streater <timstreater@greenbee.net> - 2015-03-01 17:26 +0000
        Re: Can I test ajax if I don't have any database or any server. I just run local Denis McMahon <denismfmcmahon@gmail.com> - 2015-03-02 10:14 +0000

#26951 — Can I test ajax if I don't have any database or any server. I just run local

From"Tony Johansson" <johansson.andersson@telia.com>
Date2015-03-01 00:20 +0100
SubjectCan I test ajax if I don't have any database or any server. I just run local
Message-ID<mctifg$q5r$1@dont-email.me>
I just wat to text how it works from javascript or jQuery.
Is this possible or impossible?

//Tony

[toc] | [next] | [standalone]


#26952

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2015-03-01 02:52 +0100
Message-ID<14000872.LFTkJfyLmP@PointedEars.de>
In reply to#26951
Tony Johansson wrote:

> I just wat to text how it works from javascript or jQuery.
> Is this possible or impossible?

<http://www.catb.org/~esr/faqs/smart-questions.html>

-- 
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]


#26953

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2015-02-28 20:05 -0800
Message-ID<b4adaefc-b568-4d32-b0bd-711b5e0c8d11@googlegroups.com>
In reply to#26951
On Saturday, February 28, 2015 at 5:21:03 PM UTC-6, Tony Johansson wrote:

[From subject line]:
> Can I test ajax if I don't have any database or any
> server. I just run local

> I just wat to text how it works from javascript or jQuery.
> Is this possible or impossible?


If you're on Windows create a localhost site in IIS[0], then test your queries against that. You may have to enable the IIS feature in the control panel first[1].

Alternatively, if you're using a decent IDE it will provide similar functionality.

[0] <https://support.microsoft.com/kb/323972/en-US>
[1] <http://www.iis.net/learn/install/installing-iis-7/installing-iis-on-windows-vista-and-windows-7>

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


#26954

FromTim Streater <timstreater@greenbee.net>
Date2015-03-01 09:15 +0000
Message-ID<010320150915157176%timstreater@greenbee.net>
In reply to#26951
In article <mctifg$q5r$1@dont-email.me>, Tony Johansson
<johansson.andersson@telia.com> wrote:

>I just wat to text how it works from javascript or jQuery.
>Is this possible or impossible?

Easy enough on a Mac which comes with the necessary software already
installed. Database is not relevant. You use your own machine as the
server.

-- 
"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]


#26955

FromJJ <jj4public@vfemail.net>
Date2015-03-01 18:36 +0700
Message-ID<1k1cfu4y1n4r2.15lsh4y38yjyr.dlg@40tude.net>
In reply to#26951
On Sun, 1 Mar 2015 00:20:00 +0100, Tony Johansson wrote:
> I just wat to text how it works from javascript or jQuery.
> Is this possible or impossible?
> 
> //Tony

That depends on what you mean by local.

If you meant to run it from local web server using http:// or https://, then
yes you can.

If you meant to run it directly from the file system using file://, then no.
Most web browsers don't allow the file: protool to be used with AJAX (at
least by default). I don't know about Node.js, though.

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


#26957

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2015-03-01 14:22 +0000
Message-ID<mcv7a9$dos$2@dont-email.me>
In reply to#26951
On Sun, 01 Mar 2015 00:20:00 +0100, Tony Johansson wrote:

> I just wat to text how it works from javascript or jQuery.
> Is this possible or impossible?

You can create json or xml documents and request them with ajax requests. 
But you'll need a server, because ajax talks to a server.

What you don't need for ajax is a database.

-- 
Denis McMahon, denismfmcmahon@gmail.com

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


#26958

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-03-01 16:04 +0100
Message-ID<XnsA450A3748F21eejj99@194.109.6.166>
In reply to#26957
Denis McMahon <denismfmcmahon@gmail.com> wrote on 01 mrt 2015 in 
comp.lang.javascript:

> On Sun, 01 Mar 2015 00:20:00 +0100, Tony Johansson wrote:
> 
>> I just wat to text how it works from javascript or jQuery.
>> Is this possible or impossible?
> 
> You can create json or xml documents and request them with ajax requests. 
> But you'll need a server, because ajax talks to a server.

While the x in Ajax stand for xml, 
any file can be requested and streamed,
as long as browser security restrictions are not compromised.

var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET', 'justafile.txt', true);
xmlhttp.send();

Json and xml are just ways such files can be structured.

> What you don't need for ajax is a database.

Indeed, also no swimming pools.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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


#26959

FromTim Streater <timstreater@greenbee.net>
Date2015-03-01 17:26 +0000
Message-ID<010320151726104654%timstreater@greenbee.net>
In reply to#26957
In article <mcv7a9$dos$2@dont-email.me>, Denis McMahon
<denismfmcmahon@gmail.com> wrote:

>On Sun, 01 Mar 2015 00:20:00 +0100, Tony Johansson wrote:
>
>> I just wat to text how it works from javascript or jQuery.
>> Is this possible or impossible?
>
>You can create json or xml documents and request them with ajax requests. 

No you don't. What you are requesting is *data*, which can be in any
format as long as the two sides agree on what the format is.

>But you'll need a server, because ajax talks to a server.
>
>What you don't need for ajax is a database.

Both correct. The server can be local.

-- 
"Please stop telling us what you feel. Please stop telling us what your 
intuition is. Your intuitive feelings are of no interest whatsoever, 
and nor are mine. I don't give a bugger what you feel, or what I feel. 
I want to know what the evidence shows."             -- Richard Dawkins

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


#26960

FromDenis McMahon <denismfmcmahon@gmail.com>
Date2015-03-02 10:14 +0000
Message-ID<md1d5g$68q$1@dont-email.me>
In reply to#26959
On Sun, 01 Mar 2015 17:26:10 +0000, Tim Streater wrote:

> In article <mcv7a9$dos$2@dont-email.me>, Denis McMahon
> <denismfmcmahon@gmail.com> wrote:
> 
>>On Sun, 01 Mar 2015 00:20:00 +0100, Tony Johansson wrote:
>>
>>> I just wat to text how it works from javascript or jQuery.
>>> Is this possible or impossible?
>>
>>You can create json or xml documents and request them with ajax
>>requests.
> 
> No you don't. What you are requesting is *data*, which can be in any
> format as long as the two sides agree on what the format is.

Yes he can. OP can do other things as well, but OP _CAN_ do as I 
suggested for the purposes of testing javascript / jquery ajax.

I didn't say that was the only thing he could do.

Technically you're just requesting a response, which may or may not 
include a body, but unless you want to write your own parser to convert 
the body you're sending from your server into data for your javascript to 
use on the client, json and xml tend to be the two formats that javascript 
can process natively.

Having said that, you can eg send a b64 encoded jpg image and:

document.getElementById(img_id).attr("src", "data:image/jpg;base64," + 
data);

This may well work for other media types such as music files, but richard 
should note well that I have no intention of helping him with any such 
project!

-- 
Denis McMahon, denismfmcmahon@gmail.com

[toc] | [prev] | [standalone]


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


csiph-web