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 - How to retrieve a form using AJAX, JSON and PHP onchange of value in a select box? -


i have select box, on selectinga value in have display form in there date field include javascript calendar functionalty. tried normal ajax , php combination, dont calendar in it, need know how can make happen using json , ajax , php?

thanks

every appreciated....

the code

this javascript using ajax function:

<script> function inint_ajax() { try { return new activexobject("msxml2.xmlhttp");  } catch(e) {} //ie try { return new activexobject("microsoft.xmlhttp"); } catch(e) {} //ie try { return new xmlhttprequest();          } catch(e) {} //native javascript alert("xmlhttprequest not supported"); return null; }; function dochange(path,val) { var req = inint_ajax(); req.onreadystatechange = function () {  if (req.readystate==4) {       if (req.status==200) {             document.getelementbyid('docfields').innerhtml="";             if(req.responsetext != ''){            document.getelementbyid('docfields').innerhtml=req.responsetext; //retuen value             }else{             document.getelementbyid('docfields').innerhtml="<br>&nbsp;\t<font size='2'><b>no fields available</b></font>";             }       }  } }; req.open("get", path+"getdocfields.php?doctype_id="+val); //make connection req.setrequestheader("content-type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set header req.send(null); //send value } </script> 

below html form need display calendar object (tcal) instantiated in script tag:

<form onsubmit="" action="" method="post" name="newdoc">          <table border="0" style="border: medium none;" id="docfield">           <tbody>           <tr>             <td style="border-right: medium none;">                 date             </td>          <td style="border-right: medium none;">             <input type="text" value="" maxlength="10" name="test" style="width: 100px;" id="date">         <script>          new tcal ({         'formname': 'newdoc',         'controlname': 'test'          });      </script>         </td>      </tr>     </tbody>  </table> </form> 

i not getting calendar displayed...

i see javascrip in response html, never executed if html coming through ajax call. try put javascript

new tcal ({ 'formname': 'newdoc', 'controlname': 'test' });
after xmlhttprequest object fetches , puts data in '#docfields'.

 if (req.readystate==4) {    if (req.status==200)    {       document.getelementbyid('docfields').innerhtml="";       if(req.responsetext != '')       {           document.getelementbyid('docfields').innerhtml=req.responsetext; //retuen value           /** here **/           new tcal ({'formname': 'newdoc','controlname': 'test'});           /** here **/       }       else       {           document.getelementbyid('docfields').innerhtml="no fields available";       }    } }  

hope help.


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 -