I am unable to figure out why I can't add WMS in OL3? Tiger is a default layer in Geoserver.
Below my code.
Open Street Map
</head>
<div id="map" class="map"></div>
<div id="info"> </div>
<div id="overlay" style="background-color: white; border-radius: 10px; border: 1px solid black; padding: 5px 10px;">
<script>
var wmsSource =new ol.source.ImageWMS({
url:'http://localhost:8080/geoserver/tiger/wms',
params: {'LAYERS':'tiger:tiger_roads'},
serverType:'geoserver',
crossOrigin: 'anonymous'
});
var wmsLayer=new ol.layer.Image({
source:wmsSource
});
var view = new ol.View({
center: [0, 0],
zoom: 1
});
var map = new ol.Map({
layers: [wmsLayer],
target: 'map',
view: view
});
url:'http://localhost:8080/geoserver/wms',
to see if this solves the problem. Though you should get some kind of error within geoserver log