javascript - How do i split ajax return values using jquery -


i want split ajax returned values using jquery.

here code:

var url = "/studentprogress/getstudprogdet/";     $.ajax({         url: url,         data: { currentacadyr: iacademicyeartext, currentsem: isemestertext },         cache: false,         contenttype: "application/json; charset=utf-8",         datatype: "json",         type: "get",         success: function (data) {              var result = $(data).text().split(':');             var progacadyearcode = result[0].progacadyearcode;             var productsize = result[1];             // alert(data.progacadyearcode);             //$("#toprogressacademicyearid option").filter(function () {             //    return this.text == testsem;             //}).attr('selected', true);         },         error: function (reponse) {             alert("error : " + reponse);         }     }); 

i got result this:

data = {   success: true,   progacadyearcode: 20172018,    progacadyearid: 17,    progresssemid: 47,    progresssemno: 2 } 

how extract desired values json using jquery?

based on data shown,you have directly fetch it's properties below:-

success: function (data) {    console.log(data.success);    console.log(data.progacadyearcode); //and on }, 

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -