-
jQuery $.ajax()/$.get() function always get same value for IE
Posted on June 19th, 2014 Add commentsWhen I was trying to use jQuery $.ajax() or $.get() function retrieve some random value from the server side, it’s working fine on firefox or chrome, but not IE. The server side code like below (written in ASP.NET MVC):
1234567public class HomeController : Controller{public ActionResult GetRandomCount(){return Json(new Random().Next(1, 100), JsonRequestBehavior.AllowGet);}}The client side code:
12345678<a href="javascript:void(0)" onclick="CheckCount()">Check Count</a><script>function CheckCount(){$.get('/Home/GetRandomCount', function (data) {alert(data);});}</script>I’m supposed to get a random number every time I click the link, but in IE, always same one returned. Regarding Craic Computing’s Blog, that’s because IE will cache the value first returned, and trade rest requests as identical by default, so it won’t update the value since the request URL never change.
To fix this issue, just disable cache in the jQuery function as following:12345678function CheckCount(){$.ajaxSetup ({cache: false});$.get('/Home/GetRandomCount', function (data) {alert(data);});}
16 views
-
Set up Zend framework 2 with NetBeans Running on XAMPP
Posted on April 2nd, 2014 12 commentsZend framework is an open source MVC framework implemented in PHP 5. Like other popular MVC frameworks (ASP.NET MVC, Java Spring MVC), Zend provides database abstraction, code skeleton, and more. Let’s see how to use it on NetBeans:
- Download necessary packages from Zend: Application Skeleton from here, and full framework from here. Also the composer package here (if you don’t have it on your system)
- Install php composer (if you haven’t installed), remember to select correct php.exe file under XAMPP
- Put skeleton and framework files into desired folder, unzip the framework file, but keep the skeleton zipped
3,539 views
-
Mailbox unavailable for IIS 6 smtp service
Posted on January 18th, 2014 Add commentsAfter created a smtp virtual server and enable the smtp service, if the web application still got error such “Mailbox unavailable. The server response was: 5.7.1 Unable to relay for name@email.com”, need to do following:
- Open “IIS 6 Manager”
- Under local computer name, find SMTP virtual server, and open properties for it
- On “Access” tab, click “Relay” on “Relay restrictions” section
- Choose “Only the list below”, then add loopback ip “127.0.0.1” and server ip to the list
- Restart smtp service
12 views
-
How to Fix Acrobat X Pro Won’t Open
Posted on December 28th, 2013 Add commentsAcrobat X Pro won’t start on Windows 7 (64-bit) recently. It just doesn’t respond whether I try to open PDF files with it or double-click to start the program. I am pretty sure I DID activation while I install it. After some researches, realized the reason might be I did NOT sign in. (how stupid software!!)
I did the following, and it does the job for me:- Delete the file “C:\Program Files (x86)\Common Files\Adobe\Adobe PCD\Cache\Cache.db”
- Open the program
- Sign in with your username/password (if you don’t have, apply one)
- Acrobat will be back
33 views
-
Predicates in Lambda Expression for Entity Framework Code First
Posted on July 24th, 2013 1 commentIf I have 2 entities of “People” and “Car”, and “1” People can have “Many” Car, my code first class could be like below:
12345678910111213141516171819public class People{[key]public int ID { get; set; }public string Name { get; set; }public virtual ICollection<Car> Cars { get; set; }}public class Car{[key]public string VIN { get; set; }public string Maker { get; set; }public int OwnerID { get; set; }[ForeignKey("OwnerID")]public virtual People Owner { get; set; }}
641 views
Recent Comments