I'm trying to get the movie details from IMDB according to the title of a movie, i am using imdbapi.com's API to do this.
Now it seems to be returning the JSON just fine, however i can't seem to populate the textbox and can not for the life of me work out why its not populating.
Can someone please check this out and see if you can shed some light?
I have tried :
function getData(title) {
$.getJSON('http://www.imdbapi.com/?t=' + title,
function (data) {
$('#TextBox2').text(data.Plot);
}
);
}
$('#TextBox2').val(data.Plot);
Related
I have a problem with the translation of select2 which is filled via an ajax call. I would like to translate the text result not found. If someone can help me it will be really nice.
You can customize not found text using property noResults
Example of code
{
"language": {
"noResults": function(){
return "My custom No Results Found";
}
},
I'm trying to display tweets coming from search tags and not by user, but couldn't get a result :(
http://jsfiddle.net/YS3u4/89/
Note: http://jsfiddle.net/YS3u4/90/ this doesn't work either.
var tag = "weather";
$.getJSON("https://twitter.com/search/tweets/" + tag + "?count=5&format=json&callback=?", function(data) {
$.each(data, function (index, item) {
$("<li/>").html(item.text).appendTo("#output");
});
});
The codes are fine. The problem is coming from Twitter's side. The sample link written in their API 1.1 documentation (the one that is searching for superbowl) is also throwing error.
I'm a novice programming trying to put together a web application with Angular, node.js, and the graph database neo4j.
I would like to load content from my database dynamically based on the user selecting (or rejecting) terms (clicking buttons). Every time a button is clicked the relevant term is added to an array (either exclude or include). The idea is a new call to the database would be made each time a new term is selected.
I'm stuck right now on how to go about making calls to the database to retrieve the content. I'm trying to watch the arrays for changes using $watch. Something is going wrong and I'm having issues troubleshooting the problem.
Here is the controller code:
angular.module('myApp.controllers', []).
controller('content',function($scope,$http, queryTerms, $watch){
//watch arrays of terms for changes and fetch results based on what is selected
$watch(function() { return angular.toJson( [ queryTerms.includedTerms, queryTerms.excludedTerms ] ) },
function() {
$http({
method:'get',
url:'/query/getContent',
params: {includeTerms:queryTerms.includedTerms , excludeTerms:queryTerms.excludedTerms}
}).
success(function(data){
//feed content data to display for viewing
}).
error(function(data){
$scope.test = "Error :("
});
});
});
I'm getting the following error when I use $watch:
Error: Unknown provider: $watchProvider <- $watch
Is this a terrible stupid way to go about this in general? Any advice would be greatly appreciated- I'm learning as I'm going and so far the advice I've gotten on here has be amazing. Thanks!
Use $scope.$watch instead.
controller('content', function ($scope, $http, queryTerms) {
$scope.$watch(function () {
return angular.toJson([queryTerms.includedTerms, queryTerms.excludedTerms])
},...
onCellSelect : function(rowid, iCol, cellcontent) {
$('#caseHistoryGrid').dialog('close');
$('#Case_Id').val(jQuery("#case").jqGrid('getCell', rowid,'caseId'));
$('#visitId').val(jQuery("#case").jqGrid('getCell', rowid,'visitId'));
alert($('#visitId').val()
);
}
when i click any cell. i get First VisitID only.
what s my Fault.
Please help.
Thanks in Advance
in This Code Not Problem But i get data from database using Ajax in tese data is formate
id
.....
give id is Not Unique So it gives the same celll
I've been messing around with autoNumeric, a plug-in for jQuery that formats currency fields.
I'd like to wire the plug-in so that all currency fields are formatted by the time the user sees the page, e.g., on load.
Currently, the default that I can't seem to get around is that fields are formatted upon blur, key-up or other action in the fields themselves.
I've been experimenting with the plug-in code and it looks like it will take this relative newcomer some time to resolve this, if at all.
Anybody on this?
Lille
Triggering 'focusout' event formats the field. Triggering 'change' does not work in the most recent version (1.7.4).
$('input.money').autoNumeric({aNeg: '-'}).trigger('focusout');
autoNumeric does all formatting after 'onchange' event fires. So all that you need is to programmatically fire this event. Like this:
$('input.money').autoNumeric({aNeg: '-'}).trigger('change');
Hope this helps!
I just ran into this problem myself. I had to make it more general, but this worked for me:
$('input.auto-numeric').ready(function(){
var format_options = {
aSign: '$'
};
$('input.auto-numeric').each(function(){
$(this).autoNumeric(format_options);
if($(this).attr('id')){
$(this).val($.fn.autoNumeric.Format($(this).attr('id'), $(this).val(), format_options));
}
});
});
This should work.
jQuery(function($) {
$('input.auto').ready(function(){
$('input.auto').autoNumeric();
var inputID = uniqueID; // use the jQuery.get() function to retrieve data
var formatValue = '1234.00'; // use the jQuery.get() function to retrieve data
if(jQuery().autoNumeric){
$('#id').val($.fn.autoNumeric.Format(inputID, formatValue));
}
else{
alert('plugin not available');
}
});
});
Bob
This is what I eventually did:
$(document).ready(function(){
$('input.auto').autoNumeric();
$('input.auto').each(function(){
var element = this
if(element.value !=""){
$('#'+element.id).val($.fn.autoNumeric.Format(element.id, element.value));
}
}
);
});
Another way of forcing formatting is using 'update' like
$(".input-numeric").autoNumeric('update');
In the current version 2.* and onward, this is done by default thanks to the formatOnPageLoad option that is set to true.
It's that simple ;)