Page 1 of 1

jQuery conflict

Posted: 27 Nov 2014, 12:22
by nooraban
Hi,
Where are these functions:

Code: Select all

function pdRating(id, vote) {
		
			var result 			= "pdresult" + id;
			var resultvoting 	= "pdvoting" + id;
			var pdRequest = new Request.JSON({
			url: "index.php?option=com_phocadownload&view=ratingfilea&task=rate&format=json&4f47c9ea185e33dccfff804a5f1d33cc=1",
			method: "post",
			
			onRequest: function(){
				$(result).set("html", "<img src=\"http://localhost/chemeng.ir8test/components/com_phocadownload/assets/images/icon-loading2.gif\" alt=\"\" />");
			  },
			
			onComplete: function(jsonObj) {
				try {
					var r = jsonObj;
				} catch(e) {
					var r = false;
				}
			
				if (r) {
					if (r.error == false) {
						$(result).set("text", jsonObj.message);
						
						// Refreshing Voting
						var pdRequestRefresh = new Request.JSON({
							url: "index.php?option=com_phocadownload&view=ratingfilea&task=refreshrate&small=1&format=json&4f47c9ea185e33dccfff804a5f1d33cc=1",
							method: "post",
							
							onComplete: function(json2Obj) {
								try {
									var rr = json2Obj;
								} catch(e) {
									var rr = false;
								}
							
								if (rr) {
									$(resultvoting).set("html", json2Obj.message);
								} else {
									$(resultvoting).set("text", "Error while requesting rating");
								}
							},
						
							onFailure: function() {
								$(resultvoting).set("text", "Error while requesting rating");
							}
						})
				  
						pdRequestRefresh.send({
							data: {"ratingId": id, "ratingVote": vote, "format":"json"}
						});
						//End refreshing voting
						
					} else {
						$(result).set("html", r.error);
					}
				} else {
					$(result).set("text", "Error while requesting rating");
				}
			},
			
			onFailure: function() {
				$(result).set("text", "Error while requesting rating");
			
			}
			})
	  
			pdRequest.send({
				data: {"ratingId": id, "ratingVote": vote, "format":"json"},
			});
  
		};
There is a jQuery conflict in my code and I have to use noconflict for those function, What is file and directory?

Re: jQuery conflict

Posted: 28 Nov 2014, 21:25
by Jan
Hi, here:
administrator\components\com_phocadownload\helpers\phocadownloadrate.php

Yes, this is good idea to change from $ to jQuery.

Please if you will change it and will test it, can you paste here the confirmation, it works with jQuery.

Thank you, Jan

Re: jQuery conflict

Posted: 29 Nov 2014, 10:12
by nooraban
Thank you so much Jan,
It solved just by adding jQuery $.noConflict(); before functions,
like this:

Code: Select all

<!--

		function pdRating(id, vote) {
			$.noConflict();
			
			var result 			= "pdresult" + id;
			var resultvoting 	= "pdvoting" + id;
			var pdRequest = new Request.JSON({
			url: "index.php?option=com_phocadownload&view=ratingfilea&task=rate&format=json&df4e468f2362e5b838058a654a12ba30=1",
			method: "post",
			
			onRequest: function(){
				$(result).set("html", "<img src=\"http://localhost/chemeng.ir8test/components/com_phocadownload/assets/images/icon-loading2.gif\" alt=\"\" />");
			  },
			
			onComplete: function(jsonObj) {
				try {
					var r = jsonObj;
				} catch(e) {
					var r = false;
				}
			
				if (r) {
					if (r.error == false) {
						$(result).set("text", jsonObj.message);
						
						// Refreshing Voting
						var pdRequestRefresh = new Request.JSON({
							url: "index.php?option=com_phocadownload&view=ratingfilea&task=refreshrate&small=1&format=json&df4e468f2362e5b838058a654a12ba30=1",
							method: "post",
							
							onComplete: function(json2Obj) {
								try {
									var rr = json2Obj;
								} catch(e) {
									var rr = false;
								}
							
								if (rr) {
									$(resultvoting).set("html", json2Obj.message);
								} else {
									$(resultvoting).set("text", "Error while requesting rating");
								}
							},
						
							onFailure: function() {
								$(resultvoting).set("text", "Error while requesting rating");
							}
						})
				  
						pdRequestRefresh.send({
							data: {"ratingId": id, "ratingVote": vote, "format":"json"}
						});
						//End refreshing voting
						
					} else {
						$(result).set("html", r.error);
					}
				} else {
					$(result).set("text", "Error while requesting rating");
				}
			},
			
			onFailure: function() {
				$(result).set("text", "Error while requesting rating");
			
			}
			})
	  
			pdRequest.send({
				data: {"ratingId": id, "ratingVote": vote, "format":"json"},
			});
  
		};
//-->

Re: jQuery conflict

Posted: 01 Dec 2014, 23:19
by Jan
Ok

Jan