TypeError: Cannot read property 'maps' of undefined
componentDidMount() {
window.initMap = this.initMap
((doc, script) => {
const element = doc.getElementsByTagName(script)[0];
const fjs =element;
let js = doc.createElement(script);
js.src = `https://maps.googleapis.com/maps/api/js?key=${this.props.mapKey}&callback=initMap`
if (fjs && fjs.parentNode) {
fjs.parentNode.insertBefore(js, fjs)
} else {
doc.head.appendChild(js)
}
})(document, 'script')
}
initMap = () =>{
let uluru = {lat: -25.344, lng: 131.036};
let map = new window.google.maps.Map(
document.getElementById('map'), {zoom: 4, center: uluru});
}
i am dynamically creating a script tag to load the google function and assigning the global initMap function to the local function when i am running this i am getting cannot read property maps of undefiend
can anybody help me what wrong i am doing?
reactjs google-maps create-react-app
add a comment |
componentDidMount() {
window.initMap = this.initMap
((doc, script) => {
const element = doc.getElementsByTagName(script)[0];
const fjs =element;
let js = doc.createElement(script);
js.src = `https://maps.googleapis.com/maps/api/js?key=${this.props.mapKey}&callback=initMap`
if (fjs && fjs.parentNode) {
fjs.parentNode.insertBefore(js, fjs)
} else {
doc.head.appendChild(js)
}
})(document, 'script')
}
initMap = () =>{
let uluru = {lat: -25.344, lng: 131.036};
let map = new window.google.maps.Map(
document.getElementById('map'), {zoom: 4, center: uluru});
}
i am dynamically creating a script tag to load the google function and assigning the global initMap function to the local function when i am running this i am getting cannot read property maps of undefiend
can anybody help me what wrong i am doing?
reactjs google-maps create-react-app
is there a reason why you are creating the script tag dynamically?
– Sagiv b.g
Nov 21 '18 at 12:47
@Sagivb.g the map key comes from the api from the backend so i need to create dynamic script
– Shiva Sai
Nov 21 '18 at 12:56
add a comment |
componentDidMount() {
window.initMap = this.initMap
((doc, script) => {
const element = doc.getElementsByTagName(script)[0];
const fjs =element;
let js = doc.createElement(script);
js.src = `https://maps.googleapis.com/maps/api/js?key=${this.props.mapKey}&callback=initMap`
if (fjs && fjs.parentNode) {
fjs.parentNode.insertBefore(js, fjs)
} else {
doc.head.appendChild(js)
}
})(document, 'script')
}
initMap = () =>{
let uluru = {lat: -25.344, lng: 131.036};
let map = new window.google.maps.Map(
document.getElementById('map'), {zoom: 4, center: uluru});
}
i am dynamically creating a script tag to load the google function and assigning the global initMap function to the local function when i am running this i am getting cannot read property maps of undefiend
can anybody help me what wrong i am doing?
reactjs google-maps create-react-app
componentDidMount() {
window.initMap = this.initMap
((doc, script) => {
const element = doc.getElementsByTagName(script)[0];
const fjs =element;
let js = doc.createElement(script);
js.src = `https://maps.googleapis.com/maps/api/js?key=${this.props.mapKey}&callback=initMap`
if (fjs && fjs.parentNode) {
fjs.parentNode.insertBefore(js, fjs)
} else {
doc.head.appendChild(js)
}
})(document, 'script')
}
initMap = () =>{
let uluru = {lat: -25.344, lng: 131.036};
let map = new window.google.maps.Map(
document.getElementById('map'), {zoom: 4, center: uluru});
}
i am dynamically creating a script tag to load the google function and assigning the global initMap function to the local function when i am running this i am getting cannot read property maps of undefiend
can anybody help me what wrong i am doing?
reactjs google-maps create-react-app
reactjs google-maps create-react-app
asked Nov 21 '18 at 11:59
Shiva SaiShiva Sai
1358
1358
is there a reason why you are creating the script tag dynamically?
– Sagiv b.g
Nov 21 '18 at 12:47
@Sagivb.g the map key comes from the api from the backend so i need to create dynamic script
– Shiva Sai
Nov 21 '18 at 12:56
add a comment |
is there a reason why you are creating the script tag dynamically?
– Sagiv b.g
Nov 21 '18 at 12:47
@Sagivb.g the map key comes from the api from the backend so i need to create dynamic script
– Shiva Sai
Nov 21 '18 at 12:56
is there a reason why you are creating the script tag dynamically?
– Sagiv b.g
Nov 21 '18 at 12:47
is there a reason why you are creating the script tag dynamically?
– Sagiv b.g
Nov 21 '18 at 12:47
@Sagivb.g the map key comes from the api from the backend so i need to create dynamic script
– Shiva Sai
Nov 21 '18 at 12:56
@Sagivb.g the map key comes from the api from the backend so i need to create dynamic script
– Shiva Sai
Nov 21 '18 at 12:56
add a comment |
1 Answer
1
active
oldest
votes
The problem is that the code runs before the script loads.
There are already open source project that implement Google Maps out there but if you still want to implement it by your own then you can use scriptjs. This package lets you import the resource and run functionality when its loaded. No need for a script tag in this case.
Running example:
class GoogleMap extends React.Component {
componentDidMount() {
if (!window.google || !window.google.maps) {
const { googleKey } = this.props;
// require is not working inside stackoverflow snippets
// we are using a cdn for scriptjs, you can use npm
//const $script = require(`scriptjs`);
$script(
`https://maps.googleapis.com/maps/api/js?key=${googleKey}`,
this.handleGoogleLoad
);
}
}
componentDidUpdate(prevProps) {
const { position } = this.props;
if (prevProps.position !== position) {
this.map && this.map.setCenter(position);
this.marker && this.marker.setPosition(position);
}
}
handleGoogleLoad = () => {
const { position } = this.props;
this.map = new window.google.maps.Map(this.mapRef, {
scaleControl: true,
center: null,
zoom: 10
});
this.marker = new window.google.maps.Marker({
map: this.map,
position: position
});
this.map.setCenter(position);
this.marker.setPosition(position);
};
render() {
return <div style={{ height: "350px" }} ref={ref => (this.mapRef = ref)} />;
}
}
class App extends React.Component {
state = { lat: 40.741895, lng: -73.989308, googleKey: "" };
onInputChange = ({ target }) => {
this.setState({ [target.name]: target.value });
};
render() {
const { lat, lng, googleKey } = this.state;
const position = { lat: Number(lat), lng: Number(lng) };
return (
<div className="App">
<div>
<label>Paste google key </label>
<input
name="googleKey"
value={googleKey}
onChange={this.onInputChange}
/>
<hr />
<div>Change coords</div>
<input name="lat" value={lat} onChange={this.onInputChange} />
<input name="lng" value={lng} onChange={this.onInputChange} />
</div>
<hr />
{googleKey ? (
<GoogleMap position={position} googleKey={googleKey} />
) : (
<div>Missing google key</div>
)}
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/script.js/2.5.9/script.min.js"></script>
<div id="root"/>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411586%2ftypeerror-cannot-read-property-maps-of-undefined%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem is that the code runs before the script loads.
There are already open source project that implement Google Maps out there but if you still want to implement it by your own then you can use scriptjs. This package lets you import the resource and run functionality when its loaded. No need for a script tag in this case.
Running example:
class GoogleMap extends React.Component {
componentDidMount() {
if (!window.google || !window.google.maps) {
const { googleKey } = this.props;
// require is not working inside stackoverflow snippets
// we are using a cdn for scriptjs, you can use npm
//const $script = require(`scriptjs`);
$script(
`https://maps.googleapis.com/maps/api/js?key=${googleKey}`,
this.handleGoogleLoad
);
}
}
componentDidUpdate(prevProps) {
const { position } = this.props;
if (prevProps.position !== position) {
this.map && this.map.setCenter(position);
this.marker && this.marker.setPosition(position);
}
}
handleGoogleLoad = () => {
const { position } = this.props;
this.map = new window.google.maps.Map(this.mapRef, {
scaleControl: true,
center: null,
zoom: 10
});
this.marker = new window.google.maps.Marker({
map: this.map,
position: position
});
this.map.setCenter(position);
this.marker.setPosition(position);
};
render() {
return <div style={{ height: "350px" }} ref={ref => (this.mapRef = ref)} />;
}
}
class App extends React.Component {
state = { lat: 40.741895, lng: -73.989308, googleKey: "" };
onInputChange = ({ target }) => {
this.setState({ [target.name]: target.value });
};
render() {
const { lat, lng, googleKey } = this.state;
const position = { lat: Number(lat), lng: Number(lng) };
return (
<div className="App">
<div>
<label>Paste google key </label>
<input
name="googleKey"
value={googleKey}
onChange={this.onInputChange}
/>
<hr />
<div>Change coords</div>
<input name="lat" value={lat} onChange={this.onInputChange} />
<input name="lng" value={lng} onChange={this.onInputChange} />
</div>
<hr />
{googleKey ? (
<GoogleMap position={position} googleKey={googleKey} />
) : (
<div>Missing google key</div>
)}
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/script.js/2.5.9/script.min.js"></script>
<div id="root"/>
add a comment |
The problem is that the code runs before the script loads.
There are already open source project that implement Google Maps out there but if you still want to implement it by your own then you can use scriptjs. This package lets you import the resource and run functionality when its loaded. No need for a script tag in this case.
Running example:
class GoogleMap extends React.Component {
componentDidMount() {
if (!window.google || !window.google.maps) {
const { googleKey } = this.props;
// require is not working inside stackoverflow snippets
// we are using a cdn for scriptjs, you can use npm
//const $script = require(`scriptjs`);
$script(
`https://maps.googleapis.com/maps/api/js?key=${googleKey}`,
this.handleGoogleLoad
);
}
}
componentDidUpdate(prevProps) {
const { position } = this.props;
if (prevProps.position !== position) {
this.map && this.map.setCenter(position);
this.marker && this.marker.setPosition(position);
}
}
handleGoogleLoad = () => {
const { position } = this.props;
this.map = new window.google.maps.Map(this.mapRef, {
scaleControl: true,
center: null,
zoom: 10
});
this.marker = new window.google.maps.Marker({
map: this.map,
position: position
});
this.map.setCenter(position);
this.marker.setPosition(position);
};
render() {
return <div style={{ height: "350px" }} ref={ref => (this.mapRef = ref)} />;
}
}
class App extends React.Component {
state = { lat: 40.741895, lng: -73.989308, googleKey: "" };
onInputChange = ({ target }) => {
this.setState({ [target.name]: target.value });
};
render() {
const { lat, lng, googleKey } = this.state;
const position = { lat: Number(lat), lng: Number(lng) };
return (
<div className="App">
<div>
<label>Paste google key </label>
<input
name="googleKey"
value={googleKey}
onChange={this.onInputChange}
/>
<hr />
<div>Change coords</div>
<input name="lat" value={lat} onChange={this.onInputChange} />
<input name="lng" value={lng} onChange={this.onInputChange} />
</div>
<hr />
{googleKey ? (
<GoogleMap position={position} googleKey={googleKey} />
) : (
<div>Missing google key</div>
)}
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/script.js/2.5.9/script.min.js"></script>
<div id="root"/>
add a comment |
The problem is that the code runs before the script loads.
There are already open source project that implement Google Maps out there but if you still want to implement it by your own then you can use scriptjs. This package lets you import the resource and run functionality when its loaded. No need for a script tag in this case.
Running example:
class GoogleMap extends React.Component {
componentDidMount() {
if (!window.google || !window.google.maps) {
const { googleKey } = this.props;
// require is not working inside stackoverflow snippets
// we are using a cdn for scriptjs, you can use npm
//const $script = require(`scriptjs`);
$script(
`https://maps.googleapis.com/maps/api/js?key=${googleKey}`,
this.handleGoogleLoad
);
}
}
componentDidUpdate(prevProps) {
const { position } = this.props;
if (prevProps.position !== position) {
this.map && this.map.setCenter(position);
this.marker && this.marker.setPosition(position);
}
}
handleGoogleLoad = () => {
const { position } = this.props;
this.map = new window.google.maps.Map(this.mapRef, {
scaleControl: true,
center: null,
zoom: 10
});
this.marker = new window.google.maps.Marker({
map: this.map,
position: position
});
this.map.setCenter(position);
this.marker.setPosition(position);
};
render() {
return <div style={{ height: "350px" }} ref={ref => (this.mapRef = ref)} />;
}
}
class App extends React.Component {
state = { lat: 40.741895, lng: -73.989308, googleKey: "" };
onInputChange = ({ target }) => {
this.setState({ [target.name]: target.value });
};
render() {
const { lat, lng, googleKey } = this.state;
const position = { lat: Number(lat), lng: Number(lng) };
return (
<div className="App">
<div>
<label>Paste google key </label>
<input
name="googleKey"
value={googleKey}
onChange={this.onInputChange}
/>
<hr />
<div>Change coords</div>
<input name="lat" value={lat} onChange={this.onInputChange} />
<input name="lng" value={lng} onChange={this.onInputChange} />
</div>
<hr />
{googleKey ? (
<GoogleMap position={position} googleKey={googleKey} />
) : (
<div>Missing google key</div>
)}
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/script.js/2.5.9/script.min.js"></script>
<div id="root"/>
The problem is that the code runs before the script loads.
There are already open source project that implement Google Maps out there but if you still want to implement it by your own then you can use scriptjs. This package lets you import the resource and run functionality when its loaded. No need for a script tag in this case.
Running example:
class GoogleMap extends React.Component {
componentDidMount() {
if (!window.google || !window.google.maps) {
const { googleKey } = this.props;
// require is not working inside stackoverflow snippets
// we are using a cdn for scriptjs, you can use npm
//const $script = require(`scriptjs`);
$script(
`https://maps.googleapis.com/maps/api/js?key=${googleKey}`,
this.handleGoogleLoad
);
}
}
componentDidUpdate(prevProps) {
const { position } = this.props;
if (prevProps.position !== position) {
this.map && this.map.setCenter(position);
this.marker && this.marker.setPosition(position);
}
}
handleGoogleLoad = () => {
const { position } = this.props;
this.map = new window.google.maps.Map(this.mapRef, {
scaleControl: true,
center: null,
zoom: 10
});
this.marker = new window.google.maps.Marker({
map: this.map,
position: position
});
this.map.setCenter(position);
this.marker.setPosition(position);
};
render() {
return <div style={{ height: "350px" }} ref={ref => (this.mapRef = ref)} />;
}
}
class App extends React.Component {
state = { lat: 40.741895, lng: -73.989308, googleKey: "" };
onInputChange = ({ target }) => {
this.setState({ [target.name]: target.value });
};
render() {
const { lat, lng, googleKey } = this.state;
const position = { lat: Number(lat), lng: Number(lng) };
return (
<div className="App">
<div>
<label>Paste google key </label>
<input
name="googleKey"
value={googleKey}
onChange={this.onInputChange}
/>
<hr />
<div>Change coords</div>
<input name="lat" value={lat} onChange={this.onInputChange} />
<input name="lng" value={lng} onChange={this.onInputChange} />
</div>
<hr />
{googleKey ? (
<GoogleMap position={position} googleKey={googleKey} />
) : (
<div>Missing google key</div>
)}
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/script.js/2.5.9/script.min.js"></script>
<div id="root"/>
class GoogleMap extends React.Component {
componentDidMount() {
if (!window.google || !window.google.maps) {
const { googleKey } = this.props;
// require is not working inside stackoverflow snippets
// we are using a cdn for scriptjs, you can use npm
//const $script = require(`scriptjs`);
$script(
`https://maps.googleapis.com/maps/api/js?key=${googleKey}`,
this.handleGoogleLoad
);
}
}
componentDidUpdate(prevProps) {
const { position } = this.props;
if (prevProps.position !== position) {
this.map && this.map.setCenter(position);
this.marker && this.marker.setPosition(position);
}
}
handleGoogleLoad = () => {
const { position } = this.props;
this.map = new window.google.maps.Map(this.mapRef, {
scaleControl: true,
center: null,
zoom: 10
});
this.marker = new window.google.maps.Marker({
map: this.map,
position: position
});
this.map.setCenter(position);
this.marker.setPosition(position);
};
render() {
return <div style={{ height: "350px" }} ref={ref => (this.mapRef = ref)} />;
}
}
class App extends React.Component {
state = { lat: 40.741895, lng: -73.989308, googleKey: "" };
onInputChange = ({ target }) => {
this.setState({ [target.name]: target.value });
};
render() {
const { lat, lng, googleKey } = this.state;
const position = { lat: Number(lat), lng: Number(lng) };
return (
<div className="App">
<div>
<label>Paste google key </label>
<input
name="googleKey"
value={googleKey}
onChange={this.onInputChange}
/>
<hr />
<div>Change coords</div>
<input name="lat" value={lat} onChange={this.onInputChange} />
<input name="lng" value={lng} onChange={this.onInputChange} />
</div>
<hr />
{googleKey ? (
<GoogleMap position={position} googleKey={googleKey} />
) : (
<div>Missing google key</div>
)}
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/script.js/2.5.9/script.min.js"></script>
<div id="root"/>
class GoogleMap extends React.Component {
componentDidMount() {
if (!window.google || !window.google.maps) {
const { googleKey } = this.props;
// require is not working inside stackoverflow snippets
// we are using a cdn for scriptjs, you can use npm
//const $script = require(`scriptjs`);
$script(
`https://maps.googleapis.com/maps/api/js?key=${googleKey}`,
this.handleGoogleLoad
);
}
}
componentDidUpdate(prevProps) {
const { position } = this.props;
if (prevProps.position !== position) {
this.map && this.map.setCenter(position);
this.marker && this.marker.setPosition(position);
}
}
handleGoogleLoad = () => {
const { position } = this.props;
this.map = new window.google.maps.Map(this.mapRef, {
scaleControl: true,
center: null,
zoom: 10
});
this.marker = new window.google.maps.Marker({
map: this.map,
position: position
});
this.map.setCenter(position);
this.marker.setPosition(position);
};
render() {
return <div style={{ height: "350px" }} ref={ref => (this.mapRef = ref)} />;
}
}
class App extends React.Component {
state = { lat: 40.741895, lng: -73.989308, googleKey: "" };
onInputChange = ({ target }) => {
this.setState({ [target.name]: target.value });
};
render() {
const { lat, lng, googleKey } = this.state;
const position = { lat: Number(lat), lng: Number(lng) };
return (
<div className="App">
<div>
<label>Paste google key </label>
<input
name="googleKey"
value={googleKey}
onChange={this.onInputChange}
/>
<hr />
<div>Change coords</div>
<input name="lat" value={lat} onChange={this.onInputChange} />
<input name="lng" value={lng} onChange={this.onInputChange} />
</div>
<hr />
{googleKey ? (
<GoogleMap position={position} googleKey={googleKey} />
) : (
<div>Missing google key</div>
)}
</div>
);
}
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/script.js/2.5.9/script.min.js"></script>
<div id="root"/>
edited Nov 21 '18 at 14:01
answered Nov 21 '18 at 13:18
Sagiv b.gSagiv b.g
16k32054
16k32054
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411586%2ftypeerror-cannot-read-property-maps-of-undefined%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
is there a reason why you are creating the script tag dynamically?
– Sagiv b.g
Nov 21 '18 at 12:47
@Sagivb.g the map key comes from the api from the backend so i need to create dynamic script
– Shiva Sai
Nov 21 '18 at 12:56