React component ajax call not working

componentDidMount(){ $(document).ready(function() { $.ajax({ url: "http://localhost:8080/UIServices/rest/dataService/getUserDetails?userName=SIVASO"}).then(function(data) { $('.greeting-id').append(data.dataConnections[0].databaseHost); $('.greeting-content').append(data.dataConnections[0].jdbcDriver); }); }); } <div className="panel-heading"> <h5 className="panel_title"><i className="fa fa-database"></i> <p className="greeting-id"> databaseHost is</p></h5>
I am having script that is running in html but when importing in react component in jsx it is not working not fetching data from API

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.