Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

javascript - Loop over Json using Jquery -


below json data received ajax response.

{     "error": {         "errorcode": "0001",         "errortext": "success"     },     "responselist": [         {             "count": 2,             "event": [                 {                     "startdate": null,                     "eventid": 1234,                     "eventname": "interview",                     "modifieduser": "user",                     "eventtypecode": "1",                     "eventvenue": null,                     "eventspecialinst": "isnsdf",                     "eventstatuscode": "op",                     "eventlangcode": "eng",                     "eventdesc": "sdfsadfsd",                     "fromemailid": "abcd@apple.com",                     "rsvpdeadline": 5,                     "canceledind": "yes",                     "canceldemailtext": "sdfasdfasdfasfasdfasdfasdf",                     "daystowaitlistlastcall": 5,                     "daystoreminderadmin": 6,                     "daystoreminderevent": 3,                     "daystoreminderinvitation": 2,                     "enddate": null,                     "venueaddrline1": null,                     "venueaddrline2": null,                     "venueaddrline3": null,                     "citycode": null,                     "statecode": null,                     "appid": null,                     "modifieddate": "2010-12-16",                     "countrycode": null,                     "zipcode": null,                     "user_id": null,                     "updateflag": "r"                 },                 {                     "startdate": null,                     "eventid": 4321,                     "eventname": "seasonal hiring",                     "modifieduser": "user",                     "eventtypecode": "1",                     "eventvenue": null,                     "eventspecialinst": "isnsdf",                     "eventstatuscode": "op",                     "eventlangcode": "eng",                     "eventdesc": "sdfsadfsd",                     "fromemailid": "abcd@apple.com",                     "rsvpdeadline": 5,                     "canceledind": "yes",                     "canceldemailtext": "sdfasdfasdfasfasdfasdfasdf",                     "daystowaitlistlastcall": 5,                     "daystoreminderadmin": 6,                     "daystoreminderevent": 3,                     "daystoreminderinvitation": 2,                     "enddate": null,                     "venueaddrline1": "kfc",                     "venueaddrline2": "the forum",                     "venueaddrline3": "koramangala",                     "citycode": "bangalore",                     "statecode": "karnataka",                     "appid": null,                     "modifieddate": "2010-12-16",                     "countrycode": "india",                     "zipcode": "560040",                     "user_id": null,                     "updateflag": "r"                 }             ]         }     ] } 

using below code extract information inside event object. not able it. need guidance.

$.ajax({ url:"<%=request.getcontextpath()%>/service/showinvitedevents/21",           datatype:"json",           success: function(jsondata)           {            alert("inside response success");             $.each(jsondata.responselist.event,function(i,item)           $.each(employees,function(i,item)            {              alert('iteration is' + i);             var teventname = item.eventname;              var teventvenue = item.eventvenue;             var tstartdate = item.startdate;             var tenddate = item.enddate;             var tstarend = tstartdate +" - "+ tenddate ;                          $("#eventtable tbody").append("<tr><td><a id="+teventname+i+" href=<%=request.getcontextpath()%>/service/session/1234>"+teventname+"</a></td><td>"+teventvenue+"</td><td>"+tstarend+"</td></tr>");             });  

first of can't loop on jsondata.responselist.event. jsondata.responselist array either need make double loop or if know there 1 , 1 item in responslist loop on jsondata.responselist[0].event

for rest of i'm not sure why have row:

$.each(employees,function(i,item) 

looks misstake isn't valid there(the syntax wrong , hides both , item real each).


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -