in js file : var sid= document.getElementById('mySelect'); var setitem= ""; for(i=0;i<sid.options.length;i++){ setitem= setitem+ sid.options[i].value + ","; } // Remove the last splitter setitem= setitem.substr(0,setitem.length-1); alert(setitem); Then pass the setitem to your data parameter in jQuery's AJAX. data: { list: setitem, }, while send convert the object type contentType: 'application/json; charset=utf-8', data :JSON.parse(setitem) ; using parse method. or use JSON.stringify( setitem); Note: while data sending and receiving we should take care what kind of deta we are sending and accorind to that we should take care and make sure that same data type is defined
advantage : 1. production ready application 2. complex configuartion is reduced 3. pom.xml -all dependency define via ths file . 4. used for standalone and web apps . 5. used for microservices -*** 6. @EnableAutoConfiguration automatically configures the Spring application based on its included jar files note: 6.1- Auto-configuration is usually applied based on the classpath and the defined beans 6.2- @EnableAutoConfiguration has a exclude attribute to disable an auto-configuration explicitly otherwise we can simply exclude it from the pom.xml, for example if we donot want Spring to configure the tomcat then exclude spring-bootstarter-tomcat from spring-boot-starter-web. eg. like as follwing : <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> ...
Ajax calling to controller method Sample Code: Desc: 1.>onbutton click id = 'call' click, ajax() will call to states() method that defined in controller class . and getting response into 'Result' variable object and putting response into divID of <div> tag into body . <script type="text/javascript"> $(document).ready(function() { $('#call').click(function () //'call is an ID of UI comp'; { $.ajax({ type: "post", url: "./states", //Controller...
name is an key in the jsonarr
ReplyDeleteLike .
Jsonarr=[{
Id:1,name:"sushil"
},
{
Id:12,
Name:"sk"
}
]
On v.name we will get sushil and sk values from jsonarr array object
ReplyDelete