Hi, i am currently having problem with the split function. Below are the code: -
function callback_hello(str) {
-
var str_b4_split = (str);
-
var str_af_split = str_b4_split.split(" ");
-
document.write(str_af_split);
-
}
-
callback_hello will receive a return string value and store in str_b4_split.
I tried to display str_b4_split , and it is successful using document.write(str_b4_split).
However, when i tried to add in the split, i was unable to display any of it in IE7, and firefox 2.0. Firefox shown nothing, IE7 shown "Object doesn't support this property or method" in error msg.
May i know what is the reason behind this? thank you
4 4368
Hi, i am currently having problem with the split function. Below are the code: -
function callback_hello(str) {
-
var str_b4_split = (str);
-
var str_af_split = str_b4_split.split(" ");
-
document.write(str_af_split);
-
}
-
callback_hello will receive a return string value and store in str_b4_split.
I tried to display str_b4_split , and it is successful using document.write(str_b4_split).
However, when i tried to add in the split, i was unable to display any of it in IE7, and firefox 2.0. Firefox shown nothing, IE7 shown "Object doesn't support this property or method" in error msg.
May i know what is the reason behind this? thank you
Hi,
I have tried your code in firefox 2.0 but it's working fine.
I donot have IE7 but Idonot think that will create any problem.
By the way just check if you have embeded the javascript codes inside script tags properly and also called it properly.
Happy Programming!
gits 5,390
Recognized Expert Moderator Expert
hi ...
please post more of your code especially where you call your function ... may be str is undefined at the moment where the function is called?
kind regards
Hi, I am using AjaxAgent from ajaxagent.org. I have modified the example code given in http://ajaxagent.org/doc.php . I will not attach agent.php in here(You will need it to run the code below). -
<?php
-
// server side function
-
function getdetail()
-
{
-
exec("ping www.google.com", $coutput);
-
return $coutput;
-
}
-
?>
-
-
<?php
-
// STEP 1: INCLUDING AJAX AGENT FRAMEWORK/LIBRARY
-
include_once("agent.php");
-
?>
-
-
<html>
-
<head>
-
<title>My Ajax Agent Test Page</title>
-
<?php
-
// STEP 2: INITIALIZING SERVER AGENT TO CREATE CLIENT AGENT
-
$agent->init();
-
?>
-
</head>
-
<body>
-
<script language="JavaScript">
-
-
// client function
-
function call_hello() {
-
// STEP 3: CALLING SERVER FUNCTION FROM CLIENT AGENT
-
agent.call('','getdetail','callback_hello');
-
}
-
// client callback function
-
function callback_hello(str) {
-
var myString = (str);
-
document.write(myString);
-
}
-
-
-
</script>
-
<p>testing</p>
-
<a href="javascript:call_hello();">Test the hello function</a>
-
-
</body>
-
</html>
-
Here is the result i will get: ,Pinging www.l.google.com [72.14.253.99] with 32 bytes of data:,,Reply from 72.14.253.99: bytes=32 time=197ms TTL=236,Reply from 72.14.253.99: bytes=32 time=198ms TTL=236,Reply from 72.14.253.99: bytes=32 time=197ms TTL=236,Reply from 72.14.253.99: bytes=32 time=198ms TTL=236,,Ping statistics for 72.14.253.99:, Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),,Approximate round trip times in milli-seconds:, Minimum = 197ms, Maximum = 198ms, Average = 197ms
However, after i split the myString: -
<?php
-
// server side function
-
function getdetail()
-
{
-
exec("ping www.google.com", $coutput);
-
return $coutput;
-
}
-
?>
-
-
<?php
-
// STEP 1: INCLUDING AJAX AGENT FRAMEWORK/LIBRARY
-
include_once("agent.php");
-
?>
-
-
<html>
-
<head>
-
<title>My Ajax Agent Test Page</title>
-
<?php
-
// STEP 2: INITIALIZING SERVER AGENT TO CREATE CLIENT AGENT
-
$agent->init();
-
?>
-
</head>
-
<body>
-
<script language="JavaScript">
-
-
// client function
-
function call_hello() {
-
// STEP 3: CALLING SERVER FUNCTION FROM CLIENT AGENT
-
agent.call('','getdetail','callback_hello');
-
}
-
// client callback function
-
function callback_hello(str) {
-
var myString = (str);
-
var mySplitResult = myString.split(","); //--------------->HERE
-
document.write(mySplitResult); // ------------------------------->HERE
-
}
-
-
-
</script>
-
<p>testing</p>
-
<a href="javascript:call_hello();">Test the hello function</a>
-
-
</body>
-
</html>
-
I was unable to get anything. Is there anything wrong with the code?
I have even tried with var mySplitResult = myString.split("\\,"); and still not working. Please advice. thank you.
gits 5,390
Recognized Expert Moderator Expert
so i assume that: - ',Pinging www.l.google.com [72.14.253.99] with 32 bytes of data:,,Reply from 72.14.253.99: bytes=32 time=197ms TTL=236,Reply from 72.14.253.99: bytes=32 time=198ms TTL=236,Reply from 72.14.253.99: bytes=32 time=197ms TTL=236,Reply from 72.14.253.99: bytes=32 time=198ms TTL=236,,Ping statistics for 72.14.253.99:, Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),,Approximate round trip times in milli-seconds:, Minimum = 197ms, Maximum = 198ms, Average = 197ms'
is the result that you get as param str in your callback-function? could you alert it before the split-operation?
kind regards
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Arjen |
last post by:
Hi All,
What I want to is using a string as PATTERN in a split function. This makes
it possible for me to change the PATTERN on one place in my script...
For example:
$separator = ";";
$line...
|
by: Varad |
last post by:
I'm trying to break this html statement at the "<!---->"
<br><a href='www.link1.com'>Link1</a><!----><br><a
href='www.link2.com'>Link2</a><!----><br><a
href='www.link3.com'>Link3</a><!---->
...
|
by: NewToThis |
last post by:
I am trying to use the split function to bread up lines in a file I am
reading from. Some lines are working just fine, but a couple of the lines
don't split up the way I would have thought.
...
|
by: Reb |
last post by:
Hi,
I could split only by a character. How do i split by a
string.
How can i do something like this.
e.g., somestring.Split("name");
Thanks
Reb
|
by: Christine |
last post by:
My code has a split function that should split the text file of numbers.
I've run this in previous programs as it is here and it worked, but now it
wont work for some reason and returns...
|
by: Elhanan |
last post by:
hi all..
i have the following string:
200850625~01~464~^^200850625~01~464~^^200850625~01~908~^^
which i will need to turn to a mutli-dimentional string array
i used result.Split(new...
|
by: sck10 |
last post by:
Hello,
I have a list of email addresses that I need to send email to from the
website. I am trying to use the "Split" function to get all the To's and
then use the uBound function for the...
|
by: John |
last post by:
Hi
I have written a Split function which in turn calls the standard string
split function. Code is below;
Function Split1(ByVal Expression As String, Optional ByVal Delimiter As
String = " ",...
|
by: Mody Kurani |
last post by:
Hello,
Whats wrong in my Function?
<html>
<head>
<script type="text/javascript">
function GetProvider {
var fullemail = openinviter.email_box.value;
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |