Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

String.split() JavaScript method is not working in firefox [closed]

I am trying to split a string in javascript . it works fine in chrome, but it is not working in firefox

code

var a="1#abc";
var b=a.split('#');

The error on cole is TypeError: response.split is not a function

The response in firefox is not in string. It is as [Object XMLDocument] It is not being converted by toString() method. HowI can convert it in to string

like image 536
Muhammad Usman Avatar asked Nov 27 '22 04:11

Muhammad Usman


1 Answers

I don't know what exaclty is happening but you can try to convert your variable into a string before splitting:

var a="1#abc";
var b=a.toString().split('#');
like image 66
iappwebdev Avatar answered Dec 04 '22 07:12

iappwebdev