Search Results

Search found 11527 results on 462 pages for 'ajax validator collout ex'.

Page 5/462 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • ASP.net Ajax tab container not appearing

    - by Eyla
    I created new web project using VS 2008 with enabled Ajax template with C# and Framework 3.5. I added Ajax reference to the project and I can see all Ajax toolkit in my tool box. The problem that when I add tab container with Tab Panels then run the projects nothing appear on the browser and I tried few browsers. I'm including my code and I wish that someone would help me. Regards, My Code: ................................................................ <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Contacts._Default" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <asp:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0"> <asp:TabPanel runat="server" HeaderText="TabPanel1" ID="TabPanel1"> <ContentTemplate> tab 1 </ContentTemplate> </asp:TabPanel> <asp:TabPanel runat="server" HeaderText="TabPanel2" ID="TabPanel2"> <ContentTemplate> tab 2 </ContentTemplate> </asp:TabPanel> <asp:TabPanel runat="server" HeaderText="TabPanel3" ID="TabPanel3"> <ContentTemplate> tab 3 </ContentTemplate> </asp:TabPanel> </asp:TabContainer> </div> </form> </body> </html>

    Read the article

  • jQuery .ajax() call to page method works in FF only when async is false

    - by Steve
    I'm calling a page method using .ajax() and it works in IE8 whatever the value of async is. However, in FF3.6, it only works with async set to false. When async is set to true, in Firebug, I just see status aborted. The page validates. I can work with async set to false, but any clues as to why FF can't work with async set to true? $("[id$='_www']").click(function() { var hhh = false; $.ajax({ async: false, cache: false, type: "POST", url: "/abc/def.aspx/jkl", contentType: "application/json; charset=utf-8", dataType: "json", data: "{ 'eee': '" + window.location.href.match(/\d{1,3}$/) + "', 'ttt': '" + $("[id$='_zzz']").val() + "' }", success: function(msg) { $("#ggg").html(msg.d); }, error: function(xhr, err) { hhh = true; } }); return hhh; });

    Read the article

  • jQuery .Ajax() function selector , store specific data in variable

    - by user279321
    I am new to jQuery and I have the following problem. My project has say 2 pages, 1.JSP and 2.html. Now I want to pick selected data from 2.html and use it on 1.JSP. Now this was achieved very easily using .load but I want the data to be present in a JavaScript variable rather than put it on the page (div tags, etc.), so that I can work upon that data (modify or add to database). I tried using .ajax and was able to write the following code: var value = (function () { var val = nulll; var filename = " 2.html"; $.ajax ({ 'async': false, 'global': false, 'url': filename, 'success' : function(data) { val = data; } }) return val; })() document.write(value) Where do I put the selector format (say div.id5) so that my variable have only relevant data rather than the full file data?

    Read the article

  • get the response of a jquery ajax call as an input parameter of another function:

    - by Nauman Bashir
    Hello, Is it possible to make a jquery ajax call, and get the response as an input parameter of another function: here is an example, i have the following function call at a location: updateTips(validationTextObject,objUsers.fetchAvailable()); the objUsers.fetchAvailable() function makes a ajax call to the server. The callback function on successful call would be something like this. It is being used to process the result BHUsers.prototype.recvAvailable= function(response){ // some kind of processing over here return (response["status"] == "OK")? "Available" : "Not Available"; } I want that fuction to return the processed result which can be used as a parameter to the function updateTips The primary goal of this is to be able to do all of this for multiple scenarios, rather than writing multiple functions for the same call. Also i want the calling and the response processing functions to just do what they are doing. I dont want to add html objects into it. Any Clues?

    Read the article

  • jQuery.ajax checking if there is already another xhr

    - by digitalFresh
    I have a page when, if the user is near the bottom of the page, loads the next page. I just recently switched it to jQuery, and now use the jQuery.ajax() function to get the data. However, now i cannot check if the xhr is already loading, making the page load multiple xhrs when the user near the bottom. My listener is: $(document).scroll(function () { if(/* scrollbar is near bottom */) loadxhr(dat++); //function that calls jQuery.ajax() } }); Basically, can you track the readyState of the call in a global scope?

    Read the article

  • PHP and ajax no update taking place

    - by sea_1987
    Hi There, I have an an ajax request that looks like this, $('input.fakecheck').click(function(){ alert("deleteing...."); $.ajax({ url:"/search", type:"POST", data: $(this).attr('name')+"="+$(this).attr('value')+"&remove=Remove", success:function() { alert(data); } }) }) This calls a php function which looks like this, private function _remove_from_short_list($cv_array) { if (is_array($cv_array)) { $short_list = $this->session->userdata('short_list'); $new_list = array_diff_key($short_list, $cv_array); $this->session->set_userdata('short_list', $new_list); } } Essentiallty what happens is that on my page I have a list which is essentially a list of id's taken out of the session, the user can then by click and input(this will change) delete the id from their session. However once the deletion has taken place I want to be able to refresh the list to show that it has taken place, currently nothing happens, until I manually refresh.

    Read the article

  • Implementing fallback from Google AJAX Libraries API to local jQuery

    - by Maxim Z.
    After looking up the advantages and disadvantages of using Google's AJAX Libraries API instead of using jQuery locally, I saw that someone wrote in an answer (here on Stack Overflow, of course) that it's possible to get around the downtime that Google's API sometimes experiences by somehow falling back to a local copy of the library you use. I want to use Google's AJAX Libraries API on my site, but I'm concerned about this possible downtime and I'm curious how such a fallback procedure can be implemented. Has anybody ever tried doing this? Can you point me towards some code that accomplishes such a feat? Thanks in advance.

    Read the article

  • Ajax application: using SOAP vs REST ?

    - by coder
    I'm building an ajax heavy application (client-side strictly html/css/js) which will be getting all the data and using server business logic via webservices. I know REST seems to be the hot topic but I can't find any good arguments. The main argument seems to be its "light-weight". My impression so far is that wsdl/soap based services are more expressive and allow for more a more complex transfer of data. It appears that soap would be more useful in the application I'm building where the only code consuming the services will be the js downloaded in the client browser. REST on the other hand seems to have a smaller entry barrier and so can be more useful for services like twitter in allowing other developers to consume these services easily. Also, REST seems to Te better suited for simple data transfers. So in summary SOAP is useful for complex data transfer and REST is useful in simple data transfer. I'm currently under the impression that using SOAP would be best due to the complexity of the messages but perhaps there's other factors. What are your thoughts on the pros/cons of soap/rest for a heavy ajax web app? EDIT: While the wsdl is in xml, the data I'm transferring back and forth is actually in JSON. It just appears more natural to use wsdl/soap here due to the nature of the app. The verbs GET and POST may not be enough. I may want to say something like: processQueue, or executeTimer. This is why my conclusion has been wsdl/soap would be good for bridging a complex layer between two applications (client and server) whereas REST would be better (due to its simplicity) for allowing many developer-users to consume resources programmatically. So you could say the choice falls along two lines Will the app be verb-oriented (completing tasks: use soap) or noun-oriented (consuming resources: use REST) Will the api be consumed by few developers or many developers (REST is strong for many developers)? Since such an ajax heavy app would potentially use many verbs and would only be used by the client developer it appears soap/wsdl would be the best fit.

    Read the article

  • AJAX and iFrame: Calling AJAX from inside the iFrame to Update an Outside DIV

    - by KcYxA
    Hi there, I have a page where a user can upload a file along with some other input. Because I wanted this to be AJAX-like, I resorted to using an iFrame to accomplish this. After the file is uploaded and an iFrame is loaded with a response page, I need to update a DIV outside of the iFrame with an AJAX call. The reason for separate updates, is that the result of the outside DIV depends on the input that the user provided with the file input. Can this be done? Am I approaching this the wrong way? Thank you!

    Read the article

  • How to get interpolated message in NHibernate.Validator

    - by SztupY
    Hi! I'm trying to integrate NHibernate.Validator with ASP.NET MVC client side validations, and the only problem I found is that I simply can't convert the non-interpolated message to a human-readable one. I thought this would be an easy task, but turned out to be the hardest part of the client-side validation. The main problem is that because it's not server-side, I actually only need the validation attributes that are being used, and I don't actually have an instance or anything else at hand. Here are some excerpts from what I've been already trying: // Get the the default Message Interpolator from the Engine IMessageInterpolator interp = _engine.Interpolator; if (interp == null) { // It is null?? Oh, try to create a new one interp = new NHibernate.Validator.Interpolator.DefaultMessageInterpolator(); } // We need an instance of the object that needs to be validated, se we have to create one object instance = Activator.CreateInstance(Metadata.ContainerType); // we enumerate all attributes of the property. For example we have found a PatternAttribute var a = attr as PatternAttribute; // it seems that the default message interpolator doesn't work, unless initialized if (interp is NHibernate.Validator.Interpolator.DefaultMessageInterpolator) { (interp as NHibernate.Validator.Interpolator.DefaultMessageInterpolator).Initialize(a); } // but even after it is initialized the following will throw a NullReferenceException, although all of the parameters are specified, and they are not null (except for the properties of the instance, which are all null, but this can't be changed) var message = interp.Interpolate(new InterpolationInfo(Metadata.ContainerType, instance, PropertyName, a, interp, a.Message)); I know that the above is a fairly complex code for a seemingly simple question, but I'm still stuck without solution. Is there any way to get the interpolated string out of NHValidator?

    Read the article

  • How to use Nhibernate Validator + NHib component + ddl

    - by mynkow
    I just configured my NHibValidator. My NHibernate creates the DB schema. When I set MaxLenght="20" to some property of a class then in the database the length appears in the database column. I am doing this in the NHibValidator xml file. But the problem is that I have components and cannot figure out how to achieve this behaviour. The component is configured correctly in the Customer.hbm.xml file. EDIT: Well, I found that Hibernate Validator users had the same problem two years ago. http://opensource.atlassian.com/projects/hibernate/browse/HV-25 Is this an issue for NHibernate Validator or it is fixed. If it is working tell me how please. ----------------------------------------------------- public class Customer { public virtual string Name{get;set;} public virtual Contact Contacts{ get; } } ----------------------------------------------------- public class Contact { public virtual string Address{get;set;} } ----------------------------------------------------- <?xml version="1.0" encoding="utf-8" ?> <nhv-mapping xmlns="urn:nhibernate-validator-1.0" namespace="MyNamespace" assembly="MyAssembly"> <class name="Customer"> <property name="Name"> <length max="20"/> </property> <property name="Contacts"> <notNull/> <valid/> </property> </class> </nhv-mapping> ----------------------------------------------------- <?xml version="1.0" encoding="utf-8" ?> <nhv-mapping xmlns="urn:nhibernate-validator-1.0" namespace="MyNamespace" assembly="MyAssembly"> <class name="Contact"> <property name="Address"> <length max="50"/> <valid/> </property> </class> </nhv-mapping> -----------------------------------------------------

    Read the article

  • ASP.NET MVC Validation Complete

    - by Ricardo Peres
    OK, so let’s talk about validation. Most people are probably familiar with the out of the box validation attributes that MVC knows about, from the System.ComponentModel.DataAnnotations namespace, such as EnumDataTypeAttribute, RequiredAttribute, StringLengthAttribute, RangeAttribute, RegularExpressionAttribute and CompareAttribute from the System.Web.Mvc namespace. All of these validators inherit from ValidationAttribute and perform server as well as client-side validation. In order to use them, you must include the JavaScript files MicrosoftMvcValidation.js, jquery.validate.js or jquery.validate.unobtrusive.js, depending on whether you want to use Microsoft’s own library or jQuery. No significant difference exists, but jQuery is more extensible. You can also create your own attribute by inheriting from ValidationAttribute, but, if you want to have client-side behavior, you must also implement IClientValidatable (all of the out of the box validation attributes implement it) and supply your own JavaScript validation function that mimics its server-side counterpart. Of course, you must reference the JavaScript file where the declaration function is. Let’s see an example, validating even numbers. First, the validation attribute: 1: [Serializable] 2: [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)] 3: public class IsEvenAttribute : ValidationAttribute, IClientValidatable 4: { 5: protected override ValidationResult IsValid(Object value, ValidationContext validationContext) 6: { 7: Int32 v = Convert.ToInt32(value); 8:  9: if (v % 2 == 0) 10: { 11: return (ValidationResult.Success); 12: } 13: else 14: { 15: return (new ValidationResult("Value is not even")); 16: } 17: } 18:  19: #region IClientValidatable Members 20:  21: public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) 22: { 23: yield return (new ModelClientValidationRule() { ValidationType = "iseven", ErrorMessage = "Value is not even" }); 24: } 25:  26: #endregion 27: } The iseven validation function is declared like this in JavaScript, using jQuery validation: 1: jQuery.validator.addMethod('iseven', function (value, element, params) 2: { 3: return (true); 4: return ((parseInt(value) % 2) == 0); 5: }); 6:  7: jQuery.validator.unobtrusive.adapters.add('iseven', [], function (options) 8: { 9: options.rules['iseven'] = options.params; 10: options.messages['iseven'] = options.message; 11: }); Do keep in mind that this is a simple example, for example, we are not using parameters, which may be required for some more advanced scenarios. As a side note, if you implement a custom validator that also requires a JavaScript function, you’ll probably want them together. One way to achieve this is by including the JavaScript file as an embedded resource on the same assembly where the custom attribute is declared. You do this by having its Build Action set as Embedded Resource inside Visual Studio: Then you have to declare an attribute at assembly level, perhaps in the AssemblyInfo.cs file: 1: [assembly: WebResource("SomeNamespace.IsEven.js", "text/javascript")] In your views, if you want to include a JavaScript file from an embedded resource you can use this code: 1: public static class UrlExtensions 2: { 3: private static readonly MethodInfo getResourceUrlMethod = typeof(AssemblyResourceLoader).GetMethod("GetWebResourceUrlInternal", BindingFlags.NonPublic | BindingFlags.Static); 4:  5: public static IHtmlString Resource<TType>(this UrlHelper url, String resourceName) 6: { 7: return (Resource(url, typeof(TType).Assembly.FullName, resourceName)); 8: } 9:  10: public static IHtmlString Resource(this UrlHelper url, String assemblyName, String resourceName) 11: { 12: String resourceUrl = getResourceUrlMethod.Invoke(null, new Object[] { Assembly.Load(assemblyName), resourceName, false, false, null }).ToString(); 13: return (new HtmlString(resourceUrl)); 14: } 15: } And on the view: 1: <script src="<%: this.Url.Resource("SomeAssembly", "SomeNamespace.IsEven.js") %>" type="text/javascript"></script> Then there’s the CustomValidationAttribute. It allows externalizing your validation logic to another class, so you have to tell which type and method to use. The method can be static as well as instance, if it is instance, the class cannot be abstract and must have a public parameterless constructor. It can be applied to a property as well as a class. It does not, however, support client-side validation. Let’s see an example declaration: 1: [CustomValidation(typeof(ProductValidator), "OnValidateName")] 2: public String Name 3: { 4: get; 5: set; 6: } The validation method needs this signature: 1: public static ValidationResult OnValidateName(String name) 2: { 3: if ((String.IsNullOrWhiteSpace(name) == false) && (name.Length <= 50)) 4: { 5: return (ValidationResult.Success); 6: } 7: else 8: { 9: return (new ValidationResult(String.Format("The name has an invalid value: {0}", name), new String[] { "Name" })); 10: } 11: } Note that it can be either static or instance and it must return a ValidationResult-derived class. ValidationResult.Success is null, so any non-null value is considered a validation error. The single method argument must match the property type to which the attribute is attached to or the class, in case it is applied to a class: 1: [CustomValidation(typeof(ProductValidator), "OnValidateProduct")] 2: public class Product 3: { 4: } The signature must thus be: 1: public static ValidationResult OnValidateProduct(Product product) 2: { 3: } Continuing with attribute-based validation, another possibility is RemoteAttribute. This allows specifying a controller and an action method just for performing the validation of a property or set of properties. This works in a client-side AJAX way and it can be very useful. Let’s see an example, starting with the attribute declaration and proceeding to the action method implementation: 1: [Remote("Validate", "Validation")] 2: public String Username 3: { 4: get; 5: set; 6: } The controller action method must contain an argument that can be bound to the property: 1: public ActionResult Validate(String username) 2: { 3: return (this.Json(true, JsonRequestBehavior.AllowGet)); 4: } If in your result JSON object you include a string instead of the true value, it will consider it as an error, and the validation will fail. This string will be displayed as the error message, if you have included it in your view. You can also use the remote validation approach for validating your entire entity, by including all of its properties as included fields in the attribute and having an action method that receives an entity instead of a single property: 1: [Remote("Validate", "Validation", AdditionalFields = "Price")] 2: public String Name 3: { 4: get; 5: set; 6: } 7:  8: public Decimal Price 9: { 10: get; 11: set; 12: } The action method will then be: 1: public ActionResult Validate(Product product) 2: { 3: return (this.Json("Product is not valid", JsonRequestBehavior.AllowGet)); 4: } Only the property to which the attribute is applied and the additional properties referenced by the AdditionalFields will be populated in the entity instance received by the validation method. The same rule previously stated applies, if you return anything other than true, it will be used as the validation error message for the entity. The remote validation is triggered automatically, but you can also call it explicitly. In the next example, I am causing the full entity validation, see the call to serialize(): 1: function validate() 2: { 3: var form = $('form'); 4: var data = form.serialize(); 5: var url = '<%: this.Url.Action("Validation", "Validate") %>'; 6:  7: var result = $.ajax 8: ( 9: { 10: type: 'POST', 11: url: url, 12: data: data, 13: async: false 14: } 15: ).responseText; 16:  17: if (result) 18: { 19: //error 20: } 21: } Finally, by implementing IValidatableObject, you can implement your validation logic on the object itself, that is, you make it self-validatable. This will only work server-side, that is, the ModelState.IsValid property will be set to false on the controller’s action method if the validation in unsuccessful. Let’s see how to implement it: 1: public class Product : IValidatableObject 2: { 3: public String Name 4: { 5: get; 6: set; 7: } 8:  9: public Decimal Price 10: { 11: get; 12: set; 13: } 14:  15: #region IValidatableObject Members 16: 17: public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) 18: { 19: if ((String.IsNullOrWhiteSpace(this.Name) == true) || (this.Name.Length > 50)) 20: { 21: yield return (new ValidationResult(String.Format("The name has an invalid value: {0}", this.Name), new String[] { "Name" })); 22: } 23: 24: if ((this.Price <= 0) || (this.Price > 100)) 25: { 26: yield return (new ValidationResult(String.Format("The price has an invalid value: {0}", this.Price), new String[] { "Price" })); 27: } 28: } 29: 30: #endregion 31: } The errors returned will be matched against the model properties through the MemberNames property of the ValidationResult class and will be displayed in their proper labels, if present on the view. On the controller action method you can check for model validity by looking at ModelState.IsValid and you can get actual error messages and related properties by examining all of the entries in the ModelState dictionary: 1: Dictionary<String, String> errors = new Dictionary<String, String>(); 2:  3: foreach (KeyValuePair<String, ModelState> keyValue in this.ModelState) 4: { 5: String key = keyValue.Key; 6: ModelState modelState = keyValue.Value; 7:  8: foreach (ModelError error in modelState.Errors) 9: { 10: errors[key] = error.ErrorMessage; 11: } 12: } And these are the ways to perform date validation in ASP.NET MVC. Don’t forget to use them!

    Read the article

  • jQuery AJAX slow in Firefox, fast in IE

    - by Brandon Montgomery
    I'm using jQuery to post to an ASP .NET Web Service to implement a custom auto-complete function. The code works great, except it's slow in FireFox (can't get it to go faster than 1 second). IE is blazing fast - works great. I watch the post in Firefox using Firebug. Here's the service code: <ScriptService(), _ WebService(Namespace:="http://tempuri.org/"), _ WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1), _ ToolboxItem(False)> _ Public Class TestWebSvc Inherits System.Web.Services.WebService <WebMethod(), _ ScriptMethod(ResponseFormat:=Script.Services.ResponseFormat.Json, UseHttpGet:=True)> _ Public Function GetAccounts(ByVal q As String) As Object 'Code taken out for simplicity Return result End Function End Class And the jQuery ajax call: $.ajax({ beforeSend: function (req) { req.setRequestHeader("Content-Type", "application/json"); }, contentType: "application/json; charset=utf-8", type: "GET", url: "http://localhost/Suggest/TestWebSvc.asmx/GetAccounts", data: "q='" + element.val() + "'", dataType: "json", success: testWebSvcSuccess }); As you can see, I've tried to use the HTTP GET verb instead in hopes that that would make the call faster. As it does not, I'll probably switch it back to using POST if I can. Right now I'm just focused on why it's super fast in IE and super slow in Firefox. Versions: jQuery 1.3.2; Firefox 3.0.11; IE 8.0.6001.18783 (64-bit) Thank you for any insight you can provide.

    Read the article

  • Help with an AJAX request

    - by sea_1987
    The Problem I am tring to do an ajax request to a PHP script, however I am having a problem getting the data into the format that the PHP is expecting it, the PHP is expecting the data to come in as array within an array something like, Array ( [cv_file] => Array ( [849649717] => Y [849649810] => Y ) [save] => Save CVs ) What have I tried? I have tried in my javascript to create an empty array and use that as the array key, something like this, var cv_file = new Array(); $(".drag_check").draggable({helper:"clone", opacity:"0.5"}); $(".searchPage").droppable({ accept:".drag_check", hoverClass: "dropHover", drop: function(ev, ui) { var droppedItem = ui.draggable.children(); cv_file = ui.draggable.children().attr('name'); var link = ui.draggable.children().attr('name').substr(ui.draggable.children().attr('name').indexOf("[")+1, ui.draggable.children().attr('name').lastIndexOf("]")-8) $.ajax({ type:"POST", url:"/search", data:cv_file+"&save=Save CVs", success:function(){ alert(cv_file) $('.shortList').append('<li><input type="checkbox" value="Y" class="checkbox" name="remove_cv['+link+']"/><a href="/cv/'+link+'">'+link+'</a></li>'); }, error:function() { alert("Somthing has gone wrong"); } }); } }); My Question How can I get the data into the format that the PHP is expecting, I would appreciate any help that anyone can give? Edit On alerting what the poster in the comments suggested I get he following, cv_file[849649717]&save=Save CVs Thank you

    Read the article

  • Using jQuery and AJAX works for all functions except one, really bizarre issue (from my perspective)

    - by CoreyT
    I am working on a classic asp form that has a number of dropdowns. Three of these are cascading, i.e. they rely in the previous dropdown. For almost everything this code works fine, one of them however is not playing nice. To start off I have a script tag with the following in it: $(document).ready(function () { $("#AcademicLevel").change(getList); $("#CourseDeliveryTime").change(updateLocation); $("#ProgramType").change(updateEntryTerm); }); This works just fine for the first two elements of the form, AcademicLevel and CourseDeliveryTime, the third however does not take effect however. If I use Firebug's Console and run that same line of code, $("#ProgramType").change(updateEntryTerm);, it starts to work, sort of. What happens is what confuses me. If the function it is pointing to, updateEntryTerm, has an alert() call in it, it works. If the alert is commented out, it does not work. The function is below: function updateEntryTerm() { $.ajax({ type: "POST", url: "../Classic ASP and AJAX/jQueryExample.asp", dataType: "application/x-www-form-urlencoded", data: "Action=UpdateEntryTerm&acadLevel=" + $("#AcademicLevel").val() + "&courseTime=" + $("#CourseDeliveryTime").val() + "&programType=" + $("#ProgramType").val(), async: false, success: function (msg) { $("#EntryTerm").remove(); $("#tdEntryTerm").append(msg); //alert(msg); } //, //error: function (xhr, option, err) { // alert("XHR Status: " + xhr.statusText + ", Error - " + err); //} }); } I am lost on two different issues here, First why is the call to $("#ProgramType").change(updateEntryTerm); not working unless I run it in Firebug Console? Second, why does the function itself, updateEntryTerm, not work unless the alert() call is present? Has anyone seem something like this before?

    Read the article

  • jQuery: Traversing AJAX response in Chrome/Safari

    - by jitzo
    I'm trying to traverse an AJAX response, which contains a remote web page (an HTML output). My goal is to iterate through the 'script', 'link', and 'title' elements of the remote page - load them if necessary, and embed its contents to the current page. Its working great in FF/IE, but for some reason - Chrome & Safari behaves differently: When I run a .each() loop on the response, Chrome/Safari seems to omit everything that is under the section of the page. Here's my current code: $.ajax({ url: 'remoteFile.php', cache: false, dataFilter: function(data) { console.log(data); /* The output seems to contain the entire response, including the <head> section - on all browsers, including Chrome/Safari */ $(data).filter("link, script, title").each(function(i) { console.log($(this)); /* IE/FF outputs all of the link/script/title elements, Chrome will output only those that are not in the <head> section */ }); console.log($(data)); /* This also outputs the incomplete structure on Chrome/Safari */ return data; }, success: function(response) {} }); I've been struggling with this problem for quite a while now, i've found some other similar cases on google searches, but no real solution. This happens on both jQuery 1.4.2, and jQuery 1.3.2. I really don't want to parse the response with .indexOf() and .substring() - it seems to me that it will be an overkill for the client. Many thanks in advance!

    Read the article

  • Jquery event to fire in ajax loaded content, IE & FF problem

    - by Sylph
    Hello, I'm trying to trigger onclick events in an ajax loaded content but it doesn't seem to work. Here is my code :- <li><a href="#" id="subtopic">Title</a></li> <script type="text/javascript"> $(function() { $("#subtopic").click(function() { url: test.html ,success: function(data) { $('#result').html(data); $(".filetree").treeview(); $('#result').click(); $('#result').trigger("update"); } }); }); }); </script> In my loaded content, :- <a href="#" id="addSubTopic">Click here</a> <script type="text/javascript"> $(document).ready(function() { alert("000"); }); $(function() { $("#addSubTopic").click(function() { alert("0"); $.ajax({ url: url, success: function(data) { $("#listRes").append(data); } }); }); }); </script> In IE, it works fine, the click works and I can get the "alert" but in Firefox, the whole thing just go dead. However, my jquery plugin for $(".filetree").treeview(); works fine for both IE and FF. Any advice? I have tried using .live, .trigger("update"). Thanks in advance

    Read the article

  • jQuery plugin Breaks after ajax call

    - by Jason
    Hello, I am quite a newbie to jQuery/ajax but am having a problem with my site that im making. Basically at first the page loads fine. On the boxes is a fade caption, when the title of the caption is clicked you are brought to an ajax page. Once you use the 'Back' button on browser, or the 'Back to list' button i've made the caption fade plugin no longer works and the box i had previously clicked is no longer clickable. can anyone help? heres my website: http://www.jcianfrone.com/testing jquery: h**p://www.jcianfrone.com/testing/script.js HTML: <div id="pageContent"> <div class="item"><a href="#page6"><img src="images/wrk-kd.jpg" width="286" height="200" alt="Koodikkki"></a><span id="caption"><a href="#">Title</a><p>Description</p></span></div> <div class="item"><a href="#page7"><img src="images/wrk-kd.jpg" width="286" height="200" alt="Koodikkki"></a><span id="caption"><a href="#">Title</a><p>Description</p></span></div> <div class="item"><a href="#page8"><img src="images/wrk-kd.jpg" width="286" height="200" alt="Koodikkki"></a><span id="caption"><a href="#">Title</a><p>Description</p></span></div> <div class="item"><a href="#page9"><img src="images/wrk-kd.jpg" width="286" height="200" alt="Koodikkki"></a><span id="caption"><a href="#">Title</a><p>Description</p></span></div> </div> Many thanks in advance

    Read the article

  • BING Search using ASP.NET and jQuery Ajax

    - by hajan
    The BING API provides extremely simple way to make search queries using BING. It provides nice way to get the search results as XML or JSON. In this blog post I will show one simple example on how to query BING and get the results as JSON in an ASP.NET website with help of jQuery’s getJSON ajax method. Basically we submit an HTTP GET request with the AppID which you can get in the BING Developer Center. To create new AppID, click here. Once you fill the form, submit it and you will get your AppID. Now, lets make this work in several steps. 1. Open VS.NET or Visual Web Developer.NET, create new sample project (or use existing one) and create new ASPX Web Form with name of your choice. 2. Add the following ASPX in your page body <body>     <form id="form1" runat="server">     <asp:TextBox ID="txtSearch" runat="server" /> <asp:Button ID="btnSearch" runat="server" Text="BING Search" />     <div id="result">          </div>     </form> </body> We have text box for search, button for firing the search event and div where we will place the results. 3. Next, I have created simple CSS style for the search result: <style type="text/css">             .item { width:600px; padding-top:10px; }             .title { background-color:#4196CE; color:White; font-size:18px;              font-family:Calibri, Verdana, Tahoma, Sans-Serif; padding:2px 2px 2px 2px; }     .title a { text-decoration:none; color:white}     .date { font-style:italic; font-size:10px; font-family:Verdana, Arial, Sans-Serif;}             .description { font-family:Verdana, Arial, Sans-Serif; padding:2px 2px 2px 2px; font-size:12px; }     .url { font-size: 10px; font-style:italic; font-weight:bold; color:Gray;}     .url a { text-decoration:none; color:gray;}     #txtSearch { width:450px; border:2px solid #4196CE; } </style> 4. The needed jQuery Scripts (v1.4.4 core jQuery and jQuery template plugin) <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.4.4.min.js" type="text/javascript"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js" type="text/javascript"></script> Note: I use jQuery Templates plugin in order to avoid foreach loop in the jQuery callback function. JQuery Templates also simplifies the code and allows us to create nice template for the end result. You can read more about jQuery Templates here. 5. Now, lets create another script tag where we will write our BING search script <script language="javascript" type="text/javascript">     $(document).ready(function () {         var bingAPIKey = "<Your-BING-AppID-KEY-HERE>";                  //the rest of the script goes here              }); </script> 6. Before we do any searching, we need to take a look at the search URL that we will call from our Ajax function BING Search URL : http://api.search.live.net/json.aspx?JsonType=callback&JsonCallback=?&AppId={appId}&query={query}&sources={sourceType} The URL in our example is as follows: http://api.search.live.net/json.aspx?JsonType=callback&JsonCallback=?&Appid=" + bingAPIKey + "&query=" + keyWords + "&sources=web Lets split it up with brief explanation on each part of the URL http://api.search.live.net/json.aspx – is the main part of the URL which is used to call when we need to retrieve json result set. JsonType=callback&JsonCallback=? – using JsonType, we can control the format of the response. For more info about this, refer here. Appid=” + bingAPIKey +” – the AppID we’ve got from the BING website, explained previously query=” + keyWords + “ – the search query keywords sources=web – the type of source. Possible source types can be found here. 7. Before we continue with writing the last part of the script, lets see what search result BING will send us back: {"SearchResponse":     {         "Version":"2.2",         "Query":             {                 "SearchTerms":"hajan selmani aspnet weblog"             },         "Web":             {                 "Total":16,                 "Offset":0,                 "Results":[                     {                         "Title":"Hajan's Blog",                         "Description":"microsoft asp.net development blog ... Create nice animation on your ASP.NET Menu control using jQuery by hajan",                         "Url":"http:\/\/weblogs.asp.net\/hajan\/",                         "CacheUrl":"http:\/\/cc.bingj.com\/cache.aspx?q=hajan+selmani+aspnet+weblog&d=4760941354158132&w=c9535fb0,d1d66baa",                         "DisplayUrl":"weblogs.asp.net\/hajan",                         "DateTime":"2011-03-03T18:24:00Z"                     },                     {                         "Title":"codeasp.net",                         "Description":"... social community for ASP.NET bloggers - we are one of                                         the largest ASP.NET blog ... 2\/5\/2011 1:41:00 AM by Hajan Selmani - Comments ...",                         "Url":"http:\/\/codeasp.net\/blogs\/hajan",                         "CacheUrl":"http:\/\/cc.bingj.com\/cache.aspx?q=hajan+selmani+aspnet+weblog&d=4826710187311653&w=5b41c930,676a37f8",                         "DisplayUrl":"codeasp.net\/blogs\/hajan",                         "DateTime":"2011-03-03T07:40:00Z"                     }                     ...                         ]             }     } }  To get to the result of the search response, the path is: SearchResponse.Web.Results, where we have array of objects returned back from BING. 8. The final part of the code that performs the search is $("#<%= btnSearch.ClientID %>").click(function (event) {     event.preventDefault();     var keyWords = $("#<%= txtSearch.ClientID %>").val();     var encodedKeyWords = encodeURIComponent(keyWords);     //alert(keyWords);     var url = "http://api.search.live.net/json.aspx?JsonType=callback&JsonCallback=?&Appid="+ bingAPIKey              + "&query=" + encodedKeyWords              + "&sources=web";     $.getJSON(url, function (data) {         $("#result").html("");         $("#bingSearchTemplate").tmpl(data.SearchResponse.Web.Results).appendTo("#result");     }); }); The search happens once we click the Search Button with id btnSearch. We get the keywords from the Text Box with id txtSearch and then we use encodeURIComponent. The encodeURIComponent is used to encode the special characters such as: , / ? : @ & = + $ #, which might be part of the search query string. Then we construct the URL and call it using HTTP GET. The callback function returns the data, where we first clear the html inside div with id result and after that we render the data.SearchResponse.Web.Results array of objects using template with id bingSearchTemplate and append the result into div with id result. 9. The bingSearchTemplate Template <script id="bingSearchTemplate" type="text/html">     <div class="item">         <div class="title"><a href="${Url}" target="_blank">${Title}</a></div>         <div class="date">${DateTime}</div>         <div class="searchresult">             <div class="description">             ${Description}             </div>             <div class="url">                 <a href="${Url}" target="_blank">${Url}</a>             </div>         </div>     </div> </script> If you paid attention on the search result structure that BING creates for us, you have seen properties like Url, Title, Description, DateTime etc. In the above defined template, you see the same wrapped into template tags. Some are combined to create hyperlinked URLs. 10. THE END RESULT   As you see, it’s quite simple to use BING API and make search queries with ASP.NET and jQuery. In addition, if you want to make instant search, replace this line: $(“#<%= btnSearch.ClientID %>”).click(function(event) {        event.preventDefault(); with $(“#<%= txtSearch.ClientID %>”).keyup(function() { This will trigger search on each key up in your keyboard, so if you use this approach, you won’t event need a search button. If it’s your first time working with BING API, it’s very recommended to read the following API Basics PDF document. Hope this was helpful blog post for you.

    Read the article

  • Load text from specific external DIV using AJAX?

    - by Josh
    I'm trying to load up the estimated world population from http://www.census.gov/ipc/www/popclockworld.html using AJAX, and so far, failing miserably. There's a DIV with the ID "worldnumber" on that page which contains the estimated population, so that's the only text I want to grab from the page. Here's what I've tried: $(document).ready(function(){ $("#population").load('http://www.census.gov/ipc/www/popclockworld.html #worldnumber *'); });

    Read the article

  • Calling ASP.NET MVC Controller explicitly via AJAX

    - by effkay
    I know that I can use following piece of code to refresh a div: <%=Ajax.ActionLink( "Update", "Administration", new AjaxOptions { UpdateTargetId = "grid", LoadingElementId = "grid-wait" } ) %> But this creates a link; user will have to click on it to get the view refreshed. How can I make it automatic, i.e., like say if I want the grid to be refreshed after every five seconds?

    Read the article

  • jQuery Ajax (beforeSend and complete) working properly on FireFox but not on IE8 and Chrome

    - by Farhan Zia
    I am using jQuery ajax version 1.4.1 in my MVC application (though the issue I am discussing was same with the old jQuery version 3.2.1) as well, to check during customer registration if the username is already registered. As the user clicks on the "Check Availibility" button, I am showing a busy image in place of the check button (actually hiding the check button and showing the image) while checking the availibility on the server and then displaying a message. It is a Sync call (async: false) and I used beforeSend: and complete: to show and hide the busy image and the check button. This thing is working well on Firefox but in IE 8 and Chrome, neither the busy image appear nor the check button hides rather the check button remained pressed as the whole thing has hanged. The available and not available messages appear correctly though. Below is the code: HTML in a User Control (ascx): (i have replaced the angular braces with square below) [div id="available"]This Username is Available [div id="not_available"]This Username is not available [input id="txtUsername" name="txtUsername" type="text" size="50" /]  [button id="check" name="check" type="button"]Check Availability[/button] [img id="busy" src="/Content/Images/busy.gif" /] On the top of this user control, I am linking an external javascript file that has the following code: $(document).ready(function() { $('img#busy').hide(); $('div#available').hide(); $('div#not_available').hide(); $("button#check").click(function() { var available = checkUsername($("input#txtUsername").val()); if (available == "1") { $("div#available").show(); $("div#not_available").hide(); } else { $("div#available").hide(); $("div#not_available").show(); } }); }); function checkUsername(username) { $.ajax({ type: "POST", url: "/SomeController/SomeAction", data: { "id": username }, timeout: 3000, async: false, beforeSend: function() { $("button#check").hide(); $("img#busy").show(); }, complete: function() { $("button#check").show(); $("img#busy").hide(); }, cache: false, success: function(result) { return result; }, error: function(error) { $("img#busy").hide(); $("button#check").show(); alert("Some problems have occured. Please try again later: " + error); } }); }

    Read the article

  • Using will_paginate with AJAX live search with jQuery in Rails

    - by Mark Richman
    I am using will_paginate to successfully page through records. I am also using AJAX live search via jQuery to update my results div. No problem so far. The issue I have is when trying to paginate through those live search results. I simply get "Page is loading..." with no div update. Am I missing something fundamental? # index.html.erb <form id="searchform" accept-charset="utf-8" method="get" action="/search"> Search: <input id="search" name="search" type="text" autocomplete="off" title="Search location, company, description..." /> <%= image_tag("spinner.gif", :id => "spinner", :style =>"display: none;" ) %> </form> # JobsController#search def search if params[:search].nil? @jobs = Job.paginate :page => params[:page], :order => "created_at desc" elsif params[:search] and request.xhr? @jobs = Job.search params[:search], params[:page] end render :partial => "jobs", :layout => false, :locals => { :jobs => @jobs } end # Job#search def self.search(search, page) logger.debug "Job.paginate #{search}, #{page}" paginate :per_page => @@per_page, :page => page, :conditions => ["description LIKE ? or title LIKE ? or company LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%"], :order => 'created_at DESC' end # search.js $(document).ready(function(){ $("#search").keyup(function() { $("#spinner").show(); // show the spinner var form = $(this).parents("form"); // grab the form wrapping the search bar. var url = form.attr("action"); // grab the URL from the form's action value. var formData = form.serialize(); // grab the data in the form $.get(url, formData, function(html) { // perform an AJAX get, the trailing function is what happens on successful get. $("#spinner").hide(); // hide the spinner $("#jobs").html(html); // replace the "results" div with the result of action taken }); }); });

    Read the article

  • PHP real time chat with ajax polling

    - by xRobot
    I need to create a chat similar to facebook chat. I am thinking to use ajax polling ( to send request every 2-3 seconds ). Is this a good approach ? Or I need to use other server side languages like erlang and server-comet ?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >