سؤال

In my Java Application have concept of Show Rating Star.

And My java Application giving integer value ex:4, now i'm show the rating Stars four.

So how to do this one into Jquery?

And Display the Star mean we are giving any Image tag other wise write some css to Create Star?

Give me suggestion to create Star and Display java value stars?

هل كانت مفيدة؟

المحلول

First of all your question is not clear! I hope you are developing a web application using java! I'll give you a concept to send the values to the front end.

write a web service where the front end can use a .GET or an .ajax method to call and get the data.

Get the necessary rating using your code and put it into a hash map with an identifiable key. send the hash map using jSON ( use googles GSON plugin in the java program ).

Catch it using the .AJAX or .GET response and manipulate the id using the hash map key.

Example say your service url is /getRating.

$.ajax({
    url:"/getRating",
    type: "GET",
    dataType: "json",
    success : function(response){
        //Manipulate the response received by the ajax here. (probably change the css according to the value received.)
    }
});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top