- Screen name: dat5574
dat5574's Profile
18 Posts
12 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 28-Feb-2013 09:42 AM
- Forum: Using jQuery
Hi, I want to pass back and handle a custom error message using the $.ajax method. I think I'm close but I'm stuck on parsing the error.My questions:
-------------
1.) How do I parse the [Exception] section below?. Shows it being returned to client but I was hoping it could be pulled out with a method on the XHR?
2.) Is there a way to set the "textStatus" or "errorThrown" with the custom error and use those on the client? Or are these read-only?On the server (Using ASP.NET)
//Test to force an a custom server error.
throw new System.Exception("Some error on server");
}
catch (System.Exception ex)
{
Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
Response.StatusDescription = ex.Message;
throw ex;
}
In my $.ajax error handlererror: function (XMLHttpRequest, textStatus, errorThrown) {
//want to handle error and display the custom error here.
}
In the debugger of what I'm getting back.XMLHttpRequest
<!--
[Exception]: Some error on server <!--It's getting passed back here
...stack trace was here but removed for clarity...
-->"
status: 500
statusText: "Internal Server Error"textStatus
"error"
errorThrown
"Internal Server Error"
- Hi, I want to search for checkboxes that are checked AND have a certain data-* attributeThe HTML
<input id="SomeId" type="checkbox" name="MyGridName1" data-companyId="45456" />//--This finds the checked boxes but finds all of them...
$("#SomeId input[type=checkbox]:checked").length5
//--I want to combine the query to search for both attribute values...but couldn't get it to work
$("#SomeId input[type=checkbox]:checked input[data-companyId='45456']").length0//--I ended up doing this but thought thought I could do it like above somehow.$("#SomeId input[type=checkbox]:checked").each(function () {
if ($(this).attr("data-companyId") != null) {
var companyId = $(this).attr("data-companyId")
...
}
});- Hi, say I have a nested table as listed below. I want to remove row ("<tr>") with "B". However when debugging I see tr returns 2 since there are two "tr" elements above the selection?$("#TableDemo tr:contains('B')").length
2So when I when I use $("#TableDemo tr:contains('B')").remove() it removes all "<tr>" tags. How do I make sure I just remove the one that wraps "B"?<table border="1" id="TableDemo">
<tr>
<td>
<table border="1">
<tr>
<td>A</td>
</tr>
<tr>
<td>B</td>
</tr>
<tr>
<td>C</td>
</tr>
<tr>
<td>D</td>
</tr>
</table>
</td>
</tr>
</table>- Hi, I have a search and result div as shown in the jsfiddle below. When the user clicks the toggle button to hide/show the search criteria, how can I slide the "result" div up/down slowly? It just seems to "snap" up and down and I want the movement to be smoother. Thanks, Dave.
- 10-Sep-2012 09:38 AM
- Forum: Using jQuery
Hi, I'm making the following call to a WCF web service using JQuery ajax. This works but I was wondering if there is a way that you can alert the client with a callback function that certain points of the long process are complete instead of waiting for the success method to be called at the end.Example:"Step 1 complete""Step 2 complete""Step 3 processing"Some suggestions I came across are: 1.) you could poll the process periodically on set intervals to check the progress or 2.) break up the long process into seperate $.ajax calls on the client and update the HTML progress on the client after each call.But I'm more interested in making the callbacks. Thanks for any thoughts.Current call that is working....$.ajax({
type: "POST",
url: "/Secure/WCF/MyWebService.svc/SomeLongProcess",
data: MyJsonFormattedData,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
var result = msg.d;
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});- 30-Nov-2011 03:24 PM
- Forum: jQuery Mobile
When I inject some dynamic content from an ajax request such as some dynamic checkboxes, I'll see the unstyled boxes briefly before the $("#CheckBoxContainer").trigger("create") is done applying the styles.Or any other trick to make the style transition appear less clunky? Thanks.- 29-Nov-2011 11:09 AM
- Forum: jQuery Mobile
Hi,
Testing in WP7 Mango release and have a Select Menu that will return collapsible sets from ajax based on the user selection. I load default collapsible sets then subsequent ones through ajax so they get them only when they need it. I found my load time is much better.Most options will show a two collapsibles except one which just returns one collapsible div as the HTML sample below.The issue is that everthing ABOVE this dynamic content doesn't get refreshed even though the dynamic collasible injected to the DOM is styled correctly after I call "create". The header etc above are just white/blank initially. The page doesn't get re-drawn until I tap or click on the page which causes everything to be 'refreshed' or drawn correctly. I'm guessing it has to do with the fact that this scenario the dynamic content returned isn't the same height as the original two collapsible divs and the page layout isn't updated.I assumed this because if I added an additional "dummy" collapsible div to the html below, everything is refreshed correctly because it's the same height as the one it's replacing1.) HTML returned and used in ajax onSuccess method...<div data-role="collapsible" data-collapsed="true" id="MyTopics" data-content-theme="d">
<h3>Topics</h3>
<div data-role="fieldcontain" style="padding-top:0px;" id="MyTopicsList">
<fieldset data-role="controlgroup" id="TopicCheckBoxes">
<input type="checkbox" name="NewsletterTopic" id="checkbox-117" class="custom" value="117" />
<label for="checkbox-117">Topic A</label>
<input type="checkbox" name="NewsletterTopic" id="checkbox-89" class="custom" value="89" />
<label for="checkbox-89">Topic B</label>
</fieldset>
</div>
</div>2.) The ajax success method to copy the above html into the DIV below...I tried 'create' and 'updatelayout' but with not luck to redraw the page and update the layout/spacing.
function onSuccess(data) {$("#SwappableSection").empty();$("#SwappableSection").html(function() {
$(this).html(data.trim());
$(this).trigger("updatelayout");
});$("#SwappableSection").trigger("create");
}
3.) The DIV placeholder...<div id="SwappableSection">
<!--dynamic collapsible sets go here-->
</div>- 21-Nov-2011 04:36 PM
- Forum: jQuery Mobile
Hi, I'm debugging and I'm catching an error here. What property do I check to determine the root cause of what's wrong with the changePage() method?$(document).bind("pagechangefailed", function( e, data ) {
});
- There's a connected tabs control shown in http://jquerymobile.com/designs/ under the Smartphone UI ElementsBut I can't find anything in the Docs. Is this still being planned?
- According to the Select Menus docs..
"When it has too many options to show on the device's screen, the framework will automatically create a new "page" populated with a standard list view for the options. This allows us to use the native scrolling included on the device for moving through a long list. The text inside thelabelis used as the title for this page"It would be nice to have the option to avoid this "page" dialog and just use the current custom style even for long lists. It's much cleaner looking and would be consistent. Currently I have 5 select menus grouped together. 3 have short lists while 2 use the "page" style. I just find this strange.Does anyone know of a way to avoid the "page" version from showing?- 07-Nov-2011 12:23 PM
- Forum: jQuery Mobile
Hi, I am having an issue styling an inline dialog after an ajax request. Below is my code. When I get ajax response, I populate an array to display checkboxes in the dialog. I'm doing the append/create method. The first time, it looks fine. The second time it adds CSS styles that I'm not familiar with and the company list doesn' t look as it should (specifically the data-role="controlgroup" isn't being applied on subsequent dialogs)How do I get this to work as if it's the first time every time? Do I need to somehow re-initialize the inline dialog so the additional CSS styles don't get applied?I also found that the 'pageinit' fires the first time, but not the second time. I'm wondering if this is related to the issue.$('#SearchResult').live('pageinit', function (event) {
//fires first time only.
});Ajax request to populate the html and changepage to show dialogfunction onSuccess(data) {
var result = eval('(' + data.d + ')');
if (result.length > 0) {
var listItems = [];
for (var key in result) {
listItems.push('<input type="checkbox" name="checkbox-choice-1" id="checkbox-' + key + '" class="custom"><label for="checkbox-' + key + '">' + result[key].CompanyName + '</label>');
}
}else {
alert("No records found");
}
var listItemsJoin = listItems.join(" ");
$("#SearchResultList #CompanyCheckBoxes").empty();
$("#SearchResultList #CompanyCheckBoxes").append(listItemsJoin)$('#SearchResultList #CompanyCheckBoxes').trigger('create');$.mobile.changePage("#SearchResult", {
transition: "pop",role: "dialog"});}
});
My inline dialog page<div data-role="page" id="SearchResult">
<div data-role="header" data-theme="b"><h1>Search Result</h1></div><!-- /header --><div data-role="content" data-theme="b"><div data-role="fieldcontain" id="SearchResultList"><ul data-role="listview" ><li><fieldset id="CompanyCheckBoxes" data-role="controlgroup" style="padding:0px; margin:0px;" ><!--Company search results go here --></fieldset></li></ul></div><a href="#editor">Cancel</a></div><!-- /content --><div data-role="footer" data-theme="b"></div><!-- /footer -->In the debugger...$('#SearchResultList').html() just after I append & trigger('create') the FIRST time...
<ul data-role="listview">
<li><fieldset style="margin: 0px; padding: 0px;" id="CompanyCheckBoxes" data-role="controlgroup"><div class="ui-checkbox">
<input id="checkbox-0" class="custom" name="checkbox-choice-1" value="on" type="checkbox"><label class="ui-btn ui-btn-up-c ui-btn-icon-left ui-btn-corner-all ui-checkbox-off" for="checkbox-0" data-theme="c"><span aria-hidden="true" class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">GENERAL MOTORS CORP</span><span class="ui-icon ui-icon-checkbox-off ui-icon-shadow"></span></span></label></div> <div class="ui-checkbox"><input id="checkbox-1" class="custom" name="checkbox-choice-1" value="on" type="checkbox"><label class="ui-btn ui-btn-up-c ui-btn-icon-left ui-btn-corner-all ui-checkbox-off" for="checkbox-1" data-theme="c"><span aria-hidden="true" class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">GENERAL MOTORS FINANCIAL COMPANY INC</span><span class="ui-icon ui-icon-checkbox-off ui-icon-shadow"></span></span></label></div></fieldset></li></ul>In the debugger...$('#SearchResultList').html() just after I append & trigger('create') the SECOND time...<ul class="ui-listview" data-role="listview">
<li class="ui-li ui-li-static ui-body-c"><fieldset style="margin: 0px; padding: 0px;" id="CompanyCheckBoxes" class="ui-corner-all ui-controlgroup ui-controlgroup-vertical" data-role="controlgroup"><div class="ui-checkbox"><input id="checkbox-0" class="custom" name="checkbox-choice-1" value="on" type="checkbox"><label class="ui-btn ui-btn-up-c ui-btn-icon-left ui-btn-corner-all ui-checkbox-off" for="checkbox-0" data-theme="c"><span aria-hidden="true" class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">GENERAL MOTORS CORP</span><span class="ui-icon ui-icon-checkbox-off ui-icon-shadow"></span></span></label></div> <div class="ui-checkbox"><input id="checkbox-1" class="custom" name="checkbox-choice-1" value="on" type="checkbox"><label class="ui-btn ui-btn-up-c ui-btn-icon-left ui-btn-corner-all ui-checkbox-off" for="checkbox-1" data-theme="c"><span aria-hidden="true" class="ui-btn-inner ui-btn-corner-all"><span class="ui-btn-text">GENERAL MOTORS FINANCIAL COMPANY INC</span><span class="ui-icon ui-icon-checkbox-off ui-icon-shadow"></span></span></label></div></fieldset></li></ul>- 03-Nov-2011 04:47 PM
- Forum: Developing jQuery Mobile
Hi, I have a select list with 4 options with a Collapsible-Set below it.All 3 collapsible divs in the set get created when the page is loaded with rounded corners on the top and bottom ones.However, if a user picks a certain option from the select menu, I need to hide/show the top or middle one. If the top one is hidden, the middle one is now appears first in the list but has squared corners.Can I somehow call refresh on a collapsible-set to re-apply the rounded corner styles on the remaining visible divs each time the select menu option changes?This is more aesthetic than anything but would look cleaner.Thanks- 28-Oct-2011 02:20 PM
- Forum: Developing jQuery Mobile
I'm using checkboxes in afieldsetelement with adata-role="controlgroup"attribute so that they look like they're grouped together, with no gaps between each field and rounded corners on the top and bottom fields.Is there a way to have blue dividers within the list of checkboxes with no spaces/gaps.For instance I just wanted to group the topics under each associated category. Users can pick one or any combo of these checkboxes. I'm trying to make the list easier to read and as compact as possible.------------Regions------------NorthSouthEastWest------------Industry------------ManufacturingHealth SciencesEnergyetc.- 26-Oct-2011 09:54 PM
- Forum: Developing jQuery Mobile
Hi, I was accessing the JQM "Docs and Demos" earlier in the day on a WP7/IE9 and it seemed painfully slow. I tried again at home through my wireless and it had the same results. I was also testing the"Select Menus" examples and picked the first one that contained..Standard: 7 dayRush: 3 daysExpress: next dayOvernight.Then, when I scrolled down to the other examples (i.e pick state) it would just keep showing the menu above.It would also show these menus in the WP7 native style, not the JQM custom style.If anyone else had similar issues I'd be curious.- 26-Oct-2011 11:20 AM
- Forum: Developing jQuery Mobile
Hi, I can't close a Select Menu with a lot of options since the "(X)" close button doesn't close the list.
The list appears this way as stated the JQuery Mobile docs stated in
http://jquerymobile.com/demos/1.0rc2/#/demos/1.0rc2/docs/forms/selects/"When it has too many options to show on the device's screen, the framework will automatically
create a new "page" populated with a standard list view for the options. This allows us to use
the native scrolling included on the device for moving through a long list. The text inside the
label is used as the title for this page"Testing this on the following:
1.) Blackbaud Labs iPhone emulator = Clicking the "X" close button does nothing.
2.) Windows Phone Emulator (from Windows Phone Developer Tools) = Click once nothing. Click second time, I go back 2 pages3.) Closes when running app in IE9 desktop browser.I'm not sure how to work around this. Thanks, Dave.- 04-Aug-2011 02:29 PM
- Forum: Developing jQuery Mobile
I'm trying to implement a tap-hold event on a Windows Phone 7. to display a custom context menu. But when I try with the following code I get the default Windows menu that contains:Open in new tab
Copy link
Share linkI'm trying to supress the menu using event.PreventDefault$(document).ready(function () {
$("li").each(
function (index) {
$(this).bind(
'taphold',
function (event, ui) {
event.preventDefault();
event.stopImmediatePropagation();
alert('tab-hold!');
}
);
});
}
);- 22-Jul-2011 10:19 PM
- Forum: Developing jQuery Mobile
Hi, I want to detect taphold but I'm not sure if some emulators don't detect this OR if this event is isolated to just certain elements?Thanks- HiI created the MultiPage example below frombut I created it in an .aspx web form page and wrapped the html in a form tag. However, get a javacript error when I click the href.."Microsoft JScript runtime error: Exception thrown and not caught". One, how can I determine what exactly this is. Two, I'm guessing it has to do with the <form> tag I just don't know what.I'm simulating this for something I eventually want to do. Thanks, Dave.<form id="formMultiPage" runat="server">
<!-- Start of first page -->
<div data-role="page" id="foo"><div data-role="header">
<h1>Foo</h1>
</div><!-- /header --><div data-role="content">
<p>I'm first in the source order so I'm shown as the page.</p>
<p>View internal page called <a href="#bar">bar</a></p>
</div><!-- /content --><div data-role="footer">
<h4>Page Footer</h4>
</div><!-- /header -->
</div><!-- /page -->
<!-- Start of second page -->
<div data-role="page" id="bar"><div data-role="header">
<h1>Bar</h1>
</div><!-- /header --><div data-role="content">
<p>I'm first in the source order so I'm shown as the page.</p>
<p><a href="#foo">Back to foo</a></p>
</div><!-- /content --><div data-role="footer">
<h4>Page Footer</h4>
</div><!-- /header -->
</div><!-- /page --></form>
- «Prev
- Next »
Moderate user : dat5574
© 2012 jQuery Foundation
Sponsored by
and others.



