|
So, I think I figured out the IE problem, it's caching the result rather than calling the method again. I fixed it using the method on the mozilla website here:
https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache[^]
By adding a timestamp to the request. Ironically, this works in IE, but now it doesn't work at all in Firefox. Firefox doesn't call the method in my server at all and still gives the same error. 
|
|
|
|
|
Any ideas? From some further investigation, I'm wondering if this is a cross-domain problem. But the server app seems to respond to the request coming from my webpage, I would have assumed it would have rejected the call outright if that was the problem?
|
|
|
|
|
Just an update. I did eventually get this working, but I tried a lot of things and I'm not entirely sure which one eventually fixed the problem. I ended up using jQuery and JSONP on the Javascript side, which took some amount of swearing and cursing at before it worked (the tutorials for jQuery on the jQuery website are useless), and on the server side I upgraded my project to .NET 4.0 (from 3.5) so I could add the CrossDomainScriptAccessEnabled property to my WebHttpBinding in the app.config (not sure if it was strictly necessary, but I'm too tired to try removing it to see if it'll still work without it).
Eventually it worked, I'm still not sure if cross domain was the issue or not.
|
|
|
|
|
Hi I have a repeater in my Jquery modal and onclick of row this is how i am creating an object with each column value for that row.
<ItemTemplate>
<tr id='Tr1'
onclick= 'javascript:Repeater_selectRow(this, {"myObj":{"id":"<%#DataBinder.Eval(Container.DataItem, "Id")%>","name" :"<%#DataBinder.Eval(Container.DataItem, "Name")%>","details":"<%#DataBinder.Eval(Container.DataItem, "details")%>"}},true);'>
<td bgcolor="" valign="top"><%#DataBinder.Eval(Container.DataItem, "Id")%></td>
<td bgcolor="" valign="top"><%#DataBinder.Eval(Container.DataItem, "Name")%></td>
<td bgcolor="" valign="top"><%#DataBinder.Eval(Container.DataItem, "details")%></td>
</tr>
</ItemTemplate>
This as I understanhd will give me a myObj json object on the click of row with row value.
but how could i use this object to assign the values to say a textbox or value?
also i need to acess this myObj object when i click a button on my modal to close it and pass this object back to main window.
|
|
|
|
|
no answers ?!
|
|
|
|
|
Im trying to fill a dropdown list that is inside of a usercontrol, the name of my user controls is _ucExclusion which has the property ClientType, ClientID. How can I fill the ddl ClienType with the response.d object?
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$.ajax({
type: "POST",
url: "Configuration.aspx/GetClients",
data: {},
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (response) {
alert("Worked");
I tried this but is not working
$('#<%=_ucExclusion%>').attr("ClientType").val(response.d) ;
$('<%=_ucExclusion.ClientID %>').append(response.d.toString());
},
failure: function (msg) {
alert("New Exclusion saving failed");
}
});
});
</script>
|
|
|
|
|
The code you provided has two small issues. The first is the setting of _ucExclusion.ClientID . You are forgetting the '#' sign in the selector. So it should be:
$('#<%=_ucExclusion.ClientID %>').append(response);
The second is in the entire handling inside the function of success. According the the jQuery docs the $.ajax method returns a string to the success method containing the data of the response.
|
|
|
|
|
I see nothing wrong with the success handler. The data being returned will be in the d property. Perhaps I'm missing something, would you care to elaborate?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I missed something in your code, namely dataType: "json" . So you would be getting a json object by the $.ajax method rather then a string.
Are you receiving the alert for 'worked', if not you might want to add the error: function(){...} method, I don't seem to be able to find the 'failure' option in the $.ajax documentation, so this is probably never being called even if it fails.
|
|
|
|
|
Hello to all ...
I am very basic on this of javascript, so someone could help me how to resolve this issue.
I have a javascript (HTML internal), which fetches and executes a file in another web address...
but I do not want it to do that, i want this script to execute is function directly from my local disk (file location).
Here is the script;
<html><br />
<head></head><br />
<body><br />
<div style="WIDTH: 984px; HEIGHT: 443px" ><pre><script type="text/javascript"><br />
var previewConfigs = [{<br />
type: 'flash',<br />
preview_url: "http://myflashtest.com/files/9083/preview.swf",<br />
base: "http://myflashtest/files/9083/"<br />
}];<br />
</script></pre><span id="large_item_preview"><br />
<object style="visibility: visible; Z-INDEX: 0; WIDTH: 590px; HEIGHT: 300px; TOP: -51px; LEFT: -27px; " id="large_item_preview_container" data="srcs-ff/preview.swf"></object> </span><br />
<script type="text/javascript" src="srcs-ff/jquery.js"><br />
</script><br />
<script type="text/javascript" src="srcs-ff/preview.js"><br />
</script><br />
<script type="text/javascript"><br />
if (typeof(previewConfigs) !== 'undefined') {<br />
for (var i = 0; i < previewConfigs.length; i += 1) {<br />
var preview = new ItemPreview(previewConfigs[i]);<br />
preview.display();<br />
};<br />
};<br />
</script><br />
<script type="text/javascript"><br />
$(document).ready(function() {<br />
$("tr[data-accessor=source]").click();<br />
});<br />
</script><br />
</div><br />
</body><br />
</html>
What I want is to change this part;;
preview_url: "http://myflashtest.com/files/9083/preview.swf",
base: "http://myflashtest/files/9083/"
|
|
|
|
|
Hi,
your SWF must support local play.
Some SWF going online - programmers add that in SWF.
And: Maybe SWF check host of SWF too.
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00001079.html
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/Security.html
http://kb2.adobe.com/cps/164/tn_16494.html
|
|
|
|
|
i have a form in which i am entering country code and zip code.
user should have to enter 4 numbers in country textbox after 4 numbers country textbox should not take any number.
please reply..........
|
|
|
|
|
The TextBox has a "MaxLength" attribute. It does exactly what you want.
|
|
|
|
|
That won't quite do it. The OP said NUMBERS. Your solutions will only limit the length but still allow any character to be entered.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Ok then, I missed the "numbers" part of the question. But then this can easily be taken into account by adding a compare validator that checks for the type.
|
|
|
|
|
No, a compare validator works by comparing the value of one field to another. It, or any validator, also does not prevent characters from being entered when only numbers are expected. Validators check the input afterward, they don't prevent entry.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Ok I agree on the second part. However, a compare validator can be used to check for data types
<asp:CompareValidator ID="" ControlToValidate="" Operator="DataTypeCheck" Type="Integer" runat="server" ErrorMessage="Must be Int"></asp:CompareValidator>
|
|
|
|
|
Once again, this is after the fact. It does not prevent entry. Thanks for playing.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
In which I said that you were right.
What I was replying to was the first part of your statement "No, a compare validator works by comparing the value of one field to another"
|
|
|
|
|
Using a masked edit texbox you can restrict the input to a specific lenght and type. Search for the term and you will find many examples from custom server controls to JavaScript solutions. Pick one that will work for you.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
You can use the MaxLength attribute of the textbox to limit the lengh to 4 and use this function to limit the input to only numbers. If you want to restrict entry of invalid characters, you'll have to handle the keypress event and write appropriate code.
function isNumeric(str)
{
var i=0;
for(i=0;i<str.length;i++)
{
if(str.charAt(i) < '0' || str.charAt(i) > '9')
return false;
}
return true;
}
|
|
|
|
|
There are far better examples and implementations than this.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I understand, but for a starter, this should be okay.
Moreover, by redirecting new users to pre-written frameworks and controls, we're actually discouraging them from learning the language itself.
|
|
|
|
|
Shameel wrote: we're actually discouraging them from learning the language itself.
No.
.NET is a pre-written framework, has it discouraged you from learning? JQuery is a framework, have you stopped learning JavaScript?
Lazy coders may not want to learn any further than how to use an API but true developers will learn and better themselves. Expereinced developers also know to not recreate the wheel, if there is a perfectly good framework or control to do what is needed they will use it and save the time for more complex problems.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Mark Nischalke wrote: Expereinced developers also know to not recreate the wheel, if there is a
perfectly good framework or control to do what is needed they will use it and
save the time for more complex problems.
Correct. But the OP doesn't seem to be an experienced guy. So, let him learn the language first.
|
|
|
|