Em Andamento

send / receive strings javascript/AJAX/php

i'm trying to send a string from javascript to php where the string will be written to a text file.

here's the relevant parts of the javascript:

<html>

<script type=""text/javascript"">

// Javascript

function getRequest() {

var req = false;

try{

// most browsers

req = new XMLHttpRequest();

} catch (e){

// IE

try{

req = new ActiveXObject("[url removed, login to view]");

} catch (e) {

// try an older version

try{

req = new ActiveXObject("[url removed, login to view]");

} catch (e){

return false;

}

}

}

return req;

}

function sendWords( wordsString ) {

var ajax = getRequest();

[url removed, login to view] = function(){

if([url removed, login to view] == 4){

alert([url removed, login to view]);

}

}

[url removed, login to view]('frmOne').action="[url removed, login to view]";

var jsonText = [url removed, login to view](wordsString);

[url removed, login to view]("GET", "[url removed, login to view]", true);

[url removed, login to view]("wordsString="+jsonText);

}

function getWords() {

var ajax = getRequest();

[url removed, login to view] = function(){

if([url removed, login to view] == 4){

words = [url removed, login to view];

}

}

[url removed, login to view]("GET", "[url removed, login to view]", true);

[url removed, login to view](null);

}

</script>

<?php

?>

<FORM NAME="frmOne" id="frmOne" Method = "GET" Action = "">

</html>

at the moment, i'm still stuck trying to get the sendWords function working.

this is [url removed, login to view]:

<?php

if(isset($_GET["wordsString"])) {

$jsonVal=json_decode($_GET["wordsString"]);

file_put_contents("[url removed, login to view]", $contents);

}

?>

when I can save the string variable, I also need to be able to read the file contents in php + retrieve the string in the getWords function.

this is [url removed, login to view]:

<?php

$file_handle=fopen("[url removed, login to view]", "r");

$returnString=fgets($file_handle);

fclose($file_handle);

return $returnString;

?>

Habilidades: AJAX, Javascript, PHP

Ver mais: php send string javascript, javascript send string php, ajax send string php, ajax send strings, php string html, php script null, i receive, strings, php json , json php, json string, php read text file, text javascript, php read json, php file open save, javascript json, javascript null, php form save, php read txt, javascript json html string, read send save, javascript ajax php json, php form action, json javascript string, javascript read text

Acerca do Empregador:
( 1 comentário ) Chelmsford, United Kingdom

ID do Projeto: #5136522

Premiar a:

drailean

Hi Paul It's actually a fairly easy job to do, but I don' t really understand why do you want to use json for this, since json requires the json extension to be installed into the server (which doesn't always happen) Mais

$44 USD em 0 dias
(189 Avaliações)
6.5

9 freelancers estão ofertando em média $33 para este trabalho

uhjk

A proposal has not yet been provided

$55 USD em 1 dia
(349 Comentários)
6.9
krish797

Sir, Ready to fix to read strings from file. I am looking forward to hear from you. Thanking you D.Krishna

$35 USD em 1 dia
(45 Comentários)
4.6
RITESHBATHWAL

A proposal has not yet been provided

$27 USD em 1 dia
(27 Comentários)
4.1
odindarkmoor

return $returnString; is wrong return is to return a value from a function eg function readString() { $file_handle=fopen("filename.txt", "r"); $returnString=fgets($file_handle); fclose($file_handle); return Mais

$10 USD in 3 dias
(8 Comentários)
3.6
Meagan26

Hello, I have read through your project and I am incredibly interested in taking on your project. I am an experienced developer with a diploma in the field of web develment. I have been working in the field of web d Mais

$40 USD in 3 dias
(4 Comentários)
2.7
gilhisolz

hi, we can use ajax jquery call for this. This is a functions which I am using in my developments in all the time. So I can manage this easily & complete this soon. I am doing javascript & its related technologies for Mais

$30 USD in 2 dias
(0 Comentários)
0.0
macropixel

Hello Sir, I have gone through your requirement, I can do this ASAP, as per your time line.I need a OPPORTUNITY. Thanks

$29 USD in 3 dias
(0 Comentários)
0.0
infohostingcity

Greetings from SoftMeet Technologies, SoftMeet Technology is professional web development and offshore outsourcing company based in Kochi , South India . We offer a wide range of services to reach your targeted audi Mais

$25 USD em 1 dia
(0 Comentários)
0.0